init
This commit is contained in:
commit
883f31932e
169 changed files with 5676 additions and 0 deletions
29
ansible/roles/docker/tasks/configure-mirror.yml
Normal file
29
ansible/roles/docker/tasks/configure-mirror.yml
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
-
|
||||
name: Add registry mirror host entries
|
||||
lineinfile:
|
||||
path: /etc/hosts
|
||||
regexp: "{{ item.mirror | urlsplit('hostname') | regex_escape }}"
|
||||
line: "{{ registry_mirror_ip }} {{ item.mirror | urlsplit('hostname') }}"
|
||||
loop: "{{ registry_mirrors }}"
|
||||
when: registry_mirror_ip is defined
|
||||
|
||||
-
|
||||
name: Configure Docker Hub registry mirror
|
||||
copy:
|
||||
dest: /etc/docker/daemon.json
|
||||
content: |
|
||||
{
|
||||
"registry-mirrors": [
|
||||
{% for item in registry_mirrors if item.upstream == 'docker.io' %}
|
||||
"{{ item.mirror }}"{% if not loop.last %},{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
]
|
||||
}
|
||||
mode: "0644"
|
||||
notify: restart docker
|
||||
|
||||
-
|
||||
name: Ensure Docker is restarted if mirror changed
|
||||
meta: flush_handlers
|
||||
Loading…
Add table
Add a link
Reference in a new issue