2017-12-12 23:27:18 +00:00
|
|
|
---
|
|
|
|
|
2019-05-12 10:00:32 +00:00
|
|
|
- name: "Loading distribution specific instructions for {{ ansible_distribution }}"
|
2024-03-11 23:16:03 +00:00
|
|
|
include_tasks: "{{ ansible_distribution }}.yml"
|
2017-12-12 23:27:18 +00:00
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
docker_global_ipv6: "{{ ansible_eth0.ipv6 | selectattr('scope', 'equalto', 'global') | first }}"
|
|
|
|
when: docker_configure_ipv6 and ansible_eth0 and ansible_eth0.ipv6 | selectattr('scope', 'equalto', 'global') | list | length > 0
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
docker_ipv6_subnet: "{{ docker_global_ipv6.address | ipsubnet(docker_global_ipv6.prefix) | ipsubnet(80, -1) }}"
|
|
|
|
when: docker_global_ipv6 is defined
|
|
|
|
|
|
|
|
- name: Create docker drop-in directory
|
|
|
|
file:
|
|
|
|
dest: /etc/systemd/system/docker.service.d
|
|
|
|
state: directory
|
|
|
|
|
|
|
|
- name: Configure docker start options
|
|
|
|
template:
|
|
|
|
src: docker-startopts.conf
|
|
|
|
dest: /etc/systemd/system/docker.service.d/docker-startopts.conf
|
|
|
|
register: docker_startopts
|
|
|
|
|
2020-11-09 20:26:59 +00:00
|
|
|
- name: Configure registry mirrors
|
|
|
|
copy:
|
|
|
|
content: '{"registry-mirrors": {{ docker_registry_mirrors | to_json }}}'
|
|
|
|
dest: /etc/docker/daemon.json
|
|
|
|
register: docker_mirrors
|
|
|
|
|
2017-12-12 23:27:18 +00:00
|
|
|
- name: Restart docker to apply new config
|
|
|
|
systemd:
|
|
|
|
name: docker.service
|
|
|
|
state: restarted
|
|
|
|
daemon_reload: yes
|
2020-11-09 20:26:59 +00:00
|
|
|
when: docker_startopts.changed or docker_mirrors.changed
|
2017-12-12 23:27:18 +00:00
|
|
|
|
|
|
|
- name: Create docker configuration dir
|
|
|
|
file:
|
|
|
|
dest: '{{ docker_auth_config_homedir }}/.docker'
|
|
|
|
mode: 0700
|
|
|
|
owner: '{{ docker_auth_config_user }}'
|
|
|
|
state: directory
|
|
|
|
when: docker_auth_config is defined
|
|
|
|
|
|
|
|
- name: Enable authentication for private registries
|
|
|
|
copy:
|
|
|
|
content: '{{ docker_auth_config | to_nice_json }}'
|
|
|
|
dest: '{{ docker_auth_config_homedir }}/.docker/config.json'
|
|
|
|
mode: 0600
|
|
|
|
owner: '{{ docker_auth_config_user }}'
|
|
|
|
when: docker_auth_config is defined
|
|
|
|
|
|
|
|
...
|