2016-11-04 21:40:14 +00:00
|
|
|
---
|
|
|
|
- name: Create docker service systemd directory if it doesn't exist
|
2017-02-17 21:22:34 +00:00
|
|
|
file:
|
|
|
|
path: /etc/systemd/system/docker.service.d
|
|
|
|
state: directory
|
2021-07-12 07:00:47 +00:00
|
|
|
mode: 0755
|
2016-11-04 21:40:14 +00:00
|
|
|
|
|
|
|
- name: Write docker proxy drop-in
|
|
|
|
template:
|
|
|
|
src: http-proxy.conf.j2
|
|
|
|
dest: /etc/systemd/system/docker.service.d/http-proxy.conf
|
2021-07-12 07:00:47 +00:00
|
|
|
mode: 0644
|
2018-01-12 02:56:25 +00:00
|
|
|
notify: restart docker
|
2017-10-11 18:47:27 +00:00
|
|
|
when: http_proxy is defined or https_proxy is defined
|
2016-11-04 21:40:14 +00:00
|
|
|
|
2020-08-28 08:20:53 +00:00
|
|
|
- name: get systemd version
|
2019-04-24 05:18:00 +00:00
|
|
|
# noqa 303 - systemctl is called intentionally here
|
2020-08-28 08:20:53 +00:00
|
|
|
shell: set -o pipefail && systemctl --version | head -n 1 | cut -d " " -f 2
|
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
2017-08-09 22:49:53 +00:00
|
|
|
register: systemd_version
|
2020-03-17 10:12:21 +00:00
|
|
|
when: not is_ostree
|
2017-08-14 19:31:44 +00:00
|
|
|
changed_when: false
|
2020-06-05 12:55:44 +00:00
|
|
|
check_mode: false
|
2017-08-09 22:49:53 +00:00
|
|
|
|
2016-11-04 21:40:14 +00:00
|
|
|
- name: Write docker.service systemd file
|
|
|
|
template:
|
|
|
|
src: docker.service.j2
|
|
|
|
dest: /etc/systemd/system/docker.service
|
2021-07-12 07:00:47 +00:00
|
|
|
mode: 0644
|
2016-11-04 21:40:14 +00:00
|
|
|
register: docker_service_file
|
2017-08-09 22:49:53 +00:00
|
|
|
notify: restart docker
|
2020-11-30 17:20:49 +00:00
|
|
|
when:
|
2021-10-01 16:11:23 +00:00
|
|
|
- not ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"]
|
2020-11-30 17:20:49 +00:00
|
|
|
- not is_fedora_coreos
|
2017-02-24 21:41:27 +00:00
|
|
|
|
2016-11-04 21:40:14 +00:00
|
|
|
- name: Write docker options systemd drop-in
|
|
|
|
template:
|
|
|
|
src: docker-options.conf.j2
|
|
|
|
dest: "/etc/systemd/system/docker.service.d/docker-options.conf"
|
2021-07-12 07:00:47 +00:00
|
|
|
mode: 0644
|
2016-11-04 21:40:14 +00:00
|
|
|
notify: restart docker
|
|
|
|
|
2016-12-21 16:18:11 +00:00
|
|
|
- name: Write docker dns systemd drop-in
|
|
|
|
template:
|
|
|
|
src: docker-dns.conf.j2
|
|
|
|
dest: "/etc/systemd/system/docker.service.d/docker-dns.conf"
|
2021-07-12 07:00:47 +00:00
|
|
|
mode: 0644
|
2016-12-21 16:18:11 +00:00
|
|
|
notify: restart docker
|
|
|
|
when: dns_mode != 'none' and resolvconf_mode == 'docker_dns'
|
|
|
|
|
2018-10-12 17:29:51 +00: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"
|
2021-07-12 07:00:47 +00:00
|
|
|
mode: 0644
|
2018-10-12 17:29:51 +00:00
|
|
|
notify: restart docker
|
|
|
|
when: docker_orphan_clean_up | bool
|
|
|
|
|
2021-07-12 07:00:47 +00:00
|
|
|
- name: Flush handlers
|
|
|
|
meta: flush_handlers
|