Add option for docker-mirrors

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2020-11-09 21:26:59 +01:00
parent f346ee7c80
commit 962a2adb58
Signed by: luzifer
GPG Key ID: 0066F03ED215AD7D
2 changed files with 9 additions and 1 deletions

View File

@ -14,4 +14,6 @@ docker_auth_config_homedir: /root
docker_start_opts:
- -H unix:///var/run/docker.sock
docker_registry_mirrors: []
...

View File

@ -22,12 +22,18 @@
dest: /etc/systemd/system/docker.service.d/docker-startopts.conf
register: docker_startopts
- name: Configure registry mirrors
copy:
content: '{"registry-mirrors": {{ docker_registry_mirrors | to_json }}}'
dest: /etc/docker/daemon.json
register: docker_mirrors
- name: Restart docker to apply new config
systemd:
name: docker.service
state: restarted
daemon_reload: yes
when: docker_startopts.changed
when: docker_startopts.changed or docker_mirrors.changed
- name: Create docker configuration dir
file: