2020-08-11 20:01:36 +02:00
|
|
|
---
|
|
|
|
- name: Docker configuration and service management
|
|
|
|
block:
|
|
|
|
- name: Install the Docker default options
|
|
|
|
template: src=docker-default.j2 dest={{ docker_defaults_file }} owner=root group=root mode=0644
|
|
|
|
when: ansible_service_mgr != 'systemd'
|
|
|
|
notify: Restart docker
|
2020-08-13 15:43:40 +02:00
|
|
|
tags: [ 'docker', 'docker_conf' ]
|
2020-08-11 20:01:36 +02:00
|
|
|
|
|
|
|
- name: Install the Docker daemon config
|
|
|
|
template: src=daemon.json.j2 dest=/etc/docker/daemon.json owner=root group=root mode=0644
|
|
|
|
when: ansible_service_mgr != 'systemd'
|
|
|
|
notify: Restart docker
|
2020-08-13 15:43:40 +02:00
|
|
|
tags: [ 'docker', 'docker_conf' ]
|
2020-08-11 20:01:36 +02:00
|
|
|
|
|
|
|
- name: Create the docker service systemd directory
|
|
|
|
file: dest=/etc/systemd/system/docker.service.d state=directory mode=0755
|
|
|
|
when: ansible_service_mgr == 'systemd'
|
|
|
|
tags: [ 'docker', 'docker_systemd' ]
|
|
|
|
|
|
|
|
- name: Install the Docker additional systemd unit
|
|
|
|
template: src=docker-systemd-override.conf.j2 dest=/etc/systemd/system/docker.service.d/override.conf owner=root group=root mode=0644
|
|
|
|
when: ansible_service_mgr == 'systemd'
|
|
|
|
notify: Restart docker
|
|
|
|
register: reload_systemd
|
|
|
|
tags: [ 'docker', 'docker_systemd' ]
|
|
|
|
|
|
|
|
- name: systemd reload
|
|
|
|
command: systemctl daemon-reload
|
|
|
|
when: reload_systemd is defined and reload_systemd is changed
|
|
|
|
tags: [ 'docker', 'docker_systemd' ]
|
|
|
|
|
|
|
|
- name: Ensure that the service is started and enabled
|
|
|
|
service: name=docker state=started enabled=yes
|
|
|
|
|
2020-08-13 16:12:18 +02:00
|
|
|
when: docker_install
|
2020-08-11 20:01:36 +02:00
|
|
|
tags: docker
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: Remove the docker user
|
|
|
|
user: name=docker state=absent
|
|
|
|
|
2020-08-13 16:12:18 +02:00
|
|
|
when: not docker_install
|
2020-08-11 20:01:36 +02:00
|
|
|
tags: docker
|