2016-11-05 05:40:14 +08:00
|
|
|
---
|
|
|
|
- name: Create docker service systemd directory if it doesn't exist
|
2017-02-18 05:22:34 +08:00
|
|
|
file:
|
|
|
|
path: /etc/systemd/system/docker.service.d
|
|
|
|
state: directory
|
2016-11-05 05:40:14 +08:00
|
|
|
|
|
|
|
- name: Write docker proxy drop-in
|
|
|
|
template:
|
|
|
|
src: http-proxy.conf.j2
|
|
|
|
dest: /etc/systemd/system/docker.service.d/http-proxy.conf
|
2018-01-12 10:56:25 +08:00
|
|
|
notify: restart docker
|
2017-10-12 02:47:27 +08:00
|
|
|
when: http_proxy is defined or https_proxy is defined
|
2016-11-05 05:40:14 +08:00
|
|
|
|
2017-08-10 06:49:53 +08:00
|
|
|
- name: get systemd version
|
2019-04-24 13:18:00 +08:00
|
|
|
# noqa 303 - systemctl is called intentionally here
|
2018-03-08 03:32:47 +08:00
|
|
|
shell: systemctl --version | head -n 1 | cut -d " " -f 2
|
2017-08-10 06:49:53 +08:00
|
|
|
register: systemd_version
|
2018-02-21 03:55:13 +08:00
|
|
|
when: not is_atomic
|
2017-08-15 03:31:44 +08:00
|
|
|
changed_when: false
|
2017-08-10 06:49:53 +08:00
|
|
|
|
2016-11-05 05:40:14 +08:00
|
|
|
- name: Write docker.service systemd file
|
|
|
|
template:
|
|
|
|
src: docker.service.j2
|
|
|
|
dest: /etc/systemd/system/docker.service
|
|
|
|
register: docker_service_file
|
2017-08-10 06:49:53 +08:00
|
|
|
notify: restart docker
|
2020-02-18 16:15:29 +08:00
|
|
|
when: not (ansible_os_family in ["CoreOS", "Coreos", "Container Linux by CoreOS", "Flatcar", "Flatcar Container Linux by Kinvolk"] or is_atomic)
|
2017-02-25 05:41:27 +08:00
|
|
|
|
2016-11-05 05:40:14 +08:00
|
|
|
- name: Write docker options systemd drop-in
|
|
|
|
template:
|
|
|
|
src: docker-options.conf.j2
|
|
|
|
dest: "/etc/systemd/system/docker.service.d/docker-options.conf"
|
|
|
|
notify: restart docker
|
|
|
|
|
2016-12-22 00:18:11 +08:00
|
|
|
- name: Write docker dns systemd drop-in
|
|
|
|
template:
|
|
|
|
src: docker-dns.conf.j2
|
|
|
|
dest: "/etc/systemd/system/docker.service.d/docker-dns.conf"
|
|
|
|
notify: restart docker
|
|
|
|
when: dns_mode != 'none' and resolvconf_mode == 'docker_dns'
|
|
|
|
|
2018-10-13 01:29:51 +08:00
|
|
|
- name: Copy docker orphan clean up script to the node
|
|
|
|
copy:
|
|
|
|
src: cleanup-docker-orphans.sh
|
|
|
|
dest: "{{ bin_dir }}/cleanup-docker-orphans.sh"
|
|
|
|
mode: 0755
|
|
|
|
when: docker_orphan_clean_up | bool
|
|
|
|
|
|
|
|
- name: Write docker orphan clean up systemd drop-in
|
|
|
|
template:
|
|
|
|
src: docker-orphan-cleanup.conf.j2
|
|
|
|
dest: "/etc/systemd/system/docker.service.d/docker-orphan-cleanup.conf"
|
|
|
|
notify: restart docker
|
|
|
|
when: docker_orphan_clean_up | bool
|
|
|
|
|
2017-10-12 02:47:27 +08:00
|
|
|
- meta: flush_handlers
|