2022-05-20 01:06:34 +00:00
|
|
|
- name: Install Docker
|
2019-09-18 02:32:08 +00:00
|
|
|
apt:
|
2022-05-20 01:06:34 +00:00
|
|
|
name: ['docker.io', 'docker-compose']
|
2019-09-18 02:32:08 +00:00
|
|
|
state: present
|
|
|
|
update_cache: true
|
|
|
|
|
2022-05-27 03:50:14 +00:00
|
|
|
- name: Create docker-compose root
|
|
|
|
file:
|
|
|
|
path: "{{ docker_root }}"
|
|
|
|
state: directory
|
|
|
|
|
|
|
|
- name: Install docker-compose systemd service
|
|
|
|
template:
|
|
|
|
src: docker-compose.service.j2
|
|
|
|
dest: "/etc/systemd/system/{{ docker_compose_service }}@.service"
|
|
|
|
register: compose_systemd
|
|
|
|
|
|
|
|
- name: Reload systemd manager configuration
|
|
|
|
systemd:
|
|
|
|
daemon_reload: true
|
|
|
|
when: compose_systemd.changed
|
|
|
|
|
2020-09-03 01:21:14 +00:00
|
|
|
- name: Add users to docker group
|
2019-09-18 02:32:08 +00:00
|
|
|
user:
|
2020-09-03 01:21:14 +00:00
|
|
|
name: "{{ item }}"
|
2019-09-18 02:32:08 +00:00
|
|
|
groups: docker
|
2020-08-01 00:52:57 +00:00
|
|
|
append: true
|
2020-09-03 01:21:14 +00:00
|
|
|
loop: "{{ docker_users }}"
|
2020-11-22 05:46:08 +00:00
|
|
|
when: docker_users is defined
|
2019-09-18 02:32:08 +00:00
|
|
|
|
2020-08-01 00:52:57 +00:00
|
|
|
- name: Start Docker and enable on boot
|
|
|
|
service:
|
|
|
|
name: docker
|
|
|
|
state: started
|
|
|
|
enabled: true
|