diff options
Diffstat (limited to 'ansible/roles/docker')
-rw-r--r-- | ansible/roles/docker/tasks/main.yml | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ansible/roles/docker/tasks/main.yml b/ansible/roles/docker/tasks/main.yml index 9851d4dc..7240a14c 100644 --- a/ansible/roles/docker/tasks/main.yml +++ b/ansible/roles/docker/tasks/main.yml @@ -16,11 +16,15 @@ path: /etc/docker state: directory +- name: Resolve the ansible_host address to ip + shell: LANG=C ping -n -c1 "{{ hostvars[groups.infrastructure[0]].ansible_host }}" | sed -n 1p | cut -d' ' -f3 | tr -d '()' + register: infra_ipv4 + - name: Setup docker dns settings json_add: path: /etc/docker/daemon.json key: dns - value: "{{ hostvars[groups.infrastructure[0]].ansible_default_ipv4.address }}" + value: "{{ infra_ipv4.stdout }}" notify: - Restart Docker |