forked from RamaRaju-personal-org/Ansible_files
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy-docker.yaml
56 lines (53 loc) · 1.62 KB
/
deploy-docker.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---
- name: Wait for ssh connection
hosts: all
gather_facts: False
tasks:
- name: Ensure ssh port open
ansible.builtin.wait_for:
port: 22
delay: 10
timeout: 100
search_regex: OpenSSH
host: '{{ (ansible_ssh_host|default(ansible_host))|default(inventory_hostname) }}'
vars:
ansible_connection: local
ansible_python_interpreter: /usr/bin/python
- name: Install python3, docker, docker-compose
hosts: all
become: yes
gather_facts: False
tasks:
- name: Install python3 and docker
vars:
ansible_python_interpreter: /usr/bin/python
ansible.builtin.yum:
name:
- python3
- docker
update_cache: yes
state: present
- name: Install Docker-compose
ansible.builtin.get_url:
# If the url isn't found, use 'url: https://github.com/docker/compose/releases/download/1.27.4/docker-compose-Linux-x86_64'
# See available release tags per version here: https://github.com/docker/compose/releases
url: https://github.com/docker/compose/releases/download/1.27.4/docker-compose-Linux-{{lookup('pipe', 'uname -m')}}
dest: /usr/local/bin/docker-compose
mode: +x
- name: Start docker daemon
ansible.builtin.systemd:
name: docker
state: started
- name: Install docker python module
ansible.builtin.pip:
name:
- docker
- docker-compose
- name: Create new linux user
hosts: all
become: yes
tasks:
- name: Create new linux user
ansible.builtin.user:
name: ram
groups: adm,docker