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.
This commit is contained in:
Emilien Macchi 2018-04-16 17:22:20 -07:00
parent 8e490a6932
commit d480839da5
4 changed files with 9 additions and 6 deletions

View File

@ -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'

View File

@ -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

View File

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

View File

@ -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 %}