-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy-docker-with-roles.yaml
49 lines (44 loc) · 1.08 KB
/
deploy-docker-with-roles.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
---
- 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:
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
vars:
user_groups: adm,docker
roles:
- create_user
- name: Start docker containers
hosts: all
become: yes
become_user: nana
vars_files:
- project-vars
roles:
- start_containers