feat: add the possibility to add registry mirrors
This commit is contained in:
parent
6ab3505dc8
commit
2399eebac6
4 changed files with 26 additions and 0 deletions
|
|
@ -7,3 +7,8 @@ docker_compose_base_dir: /etc/docker/compose
|
|||
|
||||
# Global docker volume directory configuration
|
||||
docker_volume_base_dir: /srv/data
|
||||
|
||||
# Docker registry mirror configuration
|
||||
# Set to empty list to disable registry mirror
|
||||
# Example: docker_registry_mirrors: ["https://mirror.example.com"]
|
||||
docker_registry_mirrors: []
|
||||
|
|
|
|||
|
|
@ -1,3 +1,9 @@
|
|||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# handlers file for base
|
||||
|
||||
- name: restart docker
|
||||
ansible.builtin.systemd:
|
||||
name: docker
|
||||
state: restarted
|
||||
when: ansible_virtualization_type != "docker"
|
||||
|
|
|
|||
|
|
@ -63,6 +63,16 @@
|
|||
update_cache: true
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
- name: Configure Docker daemon with registry mirror
|
||||
ansible.builtin.template:
|
||||
src: daemon.json.j2
|
||||
dest: /etc/docker/daemon.json
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
notify: restart docker
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
- name: Start and enable Docker service
|
||||
ansible.builtin.systemd:
|
||||
name: docker
|
||||
|
|
|
|||
5
roles/base/templates/daemon.json.j2
Normal file
5
roles/base/templates/daemon.json.j2
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
{% if docker_registry_mirrors | length > 0 %}
|
||||
"registry-mirrors": {{ docker_registry_mirrors | to_json }}
|
||||
{% endif %}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue