summaryrefslogtreecommitdiffstats
path: root/ansible
diff options
context:
space:
mode:
authorPetr Ospalý <p.ospaly@partner.samsung.com>2019-01-07 17:18:29 +0100
committerPetr Ospalý <p.ospaly@partner.samsung.com>2019-01-07 17:18:29 +0100
commita22f6b34a424d0ce25be7e560d8072a2e84e3ab8 (patch)
treeb88e8611a58d59f7eda659f8bdaf4d2667c90f50 /ansible
parentfb01a659da5c4216ff20007341d789ac9c7df933 (diff)
Fix the problem with ansible_host for docker
WIP This solves the problem with domain name without dropping the ansible_host. Ansible_host is just resolved to the ip. By using the ping command we can avoid another dependencies. Change-Id: Ic1963d3af6a8bdd68089ac8b599731e35475d81f Issue-ID: OOM-1573 Signed-off-by: Petr Ospalý <p.ospaly@partner.samsung.com>
Diffstat (limited to 'ansible')
-rw-r--r--ansible/roles/docker/tasks/main.yml6
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