diff --git a/inventory/group_vars/all.yml b/inventory/group_vars/all.yml index 2a27a4a27..51e5690c1 100644 --- a/inventory/group_vars/all.yml +++ b/inventory/group_vars/all.yml @@ -128,3 +128,8 @@ dns_server: "{{ kube_service_addresses|ipaddr('net')|ipaddr(2)|ipaddr('address') #http_proxy: "" #https_proxy: "" #no_proxy: "" + +##An list of insecure registries to allow docker to connect to +##This may be helpful if you are running your own internal registry +#insecure_registry: +# - "xxx.yyy.zzz:5000" diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index c15d148c8..711665565 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -58,6 +58,15 @@ when: ansible_service_mgr == "systemd" and (http_proxy is defined or https_proxy is defined or no_proxy is defined) +- name: create docker defaults file + file: path=/etc/default/docker state=touch + when: insecure_registry is defined + +- name: allow for insecure registries in docker defaults + lineinfile: dest=/etc/default/docker line="INSECURE_REGISTRY=\"{% for registry in insecure_registry %}--insecure-registry={{ registry }} {% endfor %}\"" + when: insecure_registry is defined + notify: restart docker + - meta: flush_handlers - name: ensure docker service is started and enabled