Browse Source

Restore old task for docker-daemon.json

This code:
  {% if container_registry_mirrors | length > 0 %}registry-mirrors: [{{ container_registry_mirrors }}]{% endif %}

Needs to include the brackets and I haven't found a way yet to include
them without Ansible failure. In the meantime, let's go back on the old
code.
changes/10/564510/1
Emilien Macchi 4 years ago
parent
commit
d480839da5
  1. 2
      defaults/main.yml
  2. 4
      tasks/docker.yml
  3. 6
      templates/docker-daemon.json.j2
  4. 3
      vars/main.yml

2
defaults/main.yml

@ -10,5 +10,5 @@ container_registry_insecure_registries: []
container_registry_network_options: ''
container_registry_host: localhost
container_registry_port: 8787
container_registry_mirrors: []
container_registry_mirror: ''
container_registry_storage_options: '-s overlay2'

4
tasks/docker.yml

@ -50,8 +50,8 @@
registry_flags: "{% for reg in container_registry_insecure_registries %}--insecure-registry {{ reg }}{% if not loop.last %} {% endif %}{% endfor %}"
- name: manage /etc/docker/daemon.json
copy:
content: "{{ _docker_daemon_config | from_yaml | to_nice_json }}"
template:
src: docker-daemon.json.j2
dest: /etc/docker/daemon.json
notify: restart docker service

6
templates/docker-daemon.json.j2

@ -0,0 +1,6 @@
{
{% if container_registry_mirror != "" %}
"registry-mirrors": ["{{ container_registry_mirror }}"],
{% endif %}
"debug": {{ container_registry_debug|lower }}
}

3
vars/main.yml

@ -1,4 +1 @@
_full_docker_options: "{% if ansible_selinux.status == 'enabled' %}--selinux-enabled {% endif %}{{ container_registry_docker_options }}"
_docker_daemon_config: |
debug: {{ container_registry_debug }}
{% if container_registry_mirrors | length > 0 %}registry-mirrors: [{{ container_registry_mirrors }}]{% endif %}

Loading…
Cancel
Save