From d556fd68d88f8b34bb1f42013f86247035ea3ea3 Mon Sep 17 00:00:00 2001 From: John Fulton Date: Wed, 10 Oct 2018 15:12:26 +0200 Subject: [PATCH] Do not reference ansible_hostname if it is undefined Change-Id: I59c3de74c41b97ed1803d82c69db52199f27393e Closes-Bug: #1797117 --- docker/services/ceph-ansible/ceph-base.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker/services/ceph-ansible/ceph-base.yaml b/docker/services/ceph-ansible/ceph-base.yaml index be482c0074..f81ac9af4c 100644 --- a/docker/services/ceph-ansible/ceph-base.yaml +++ b/docker/services/ceph-ansible/ceph-base.yaml @@ -387,12 +387,14 @@ outputs: {{ ceph_group ~ 's:' }} hosts: {% for host in groups['ceph_' ~ ceph_group] -%} + {%- if hostvars.raw_get(host)['ansible_hostname'] is defined -%} {%- if hostvars.raw_get(host)['ansible_hostname'] not in blacklisted_hostnames -%} {{ hostvars.raw_get(host)['ansible_hostname'] }}: ansible_user: {{ hostvars.raw_get(host)['ansible_ssh_user'] | default('root') }} ansible_host: {{ hostvars.raw_get(host)['ansible_host'] | default(host) }} ansible_become: true {% endif -%} + {% endif -%} {%- endfor -%} {%- endif -%}