-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-docker-with-roles.yml
51 lines (49 loc) · 1.26 KB
/
setup-docker-with-roles.yml
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
---
- name: Wait for ssh connection
hosts: all
gather_facts: no
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) }}'
connection: local
- name: Install python3, docker and git
hosts: all
become: yes
gather_facts: no
tasks:
- name: Install python3 and docker
vars:
ansible_python_interpreter: /usr/bin/python
ansible.builtin.yum:
name:
- python3
- docker
- git
update_cache: yes
state: present
- name: Install docker-compose
ansible.builtin.get_url:
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 a new linux user
hosts: all
become: yes
vars_files:
- project-vars
roles:
- create_user