Skip to content

Commit 1b7b9f2

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Handle empty remote_hosts in kayobe connectivity check"
2 parents c275aec + c59e261 commit 1b7b9f2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ansible/network-connectivity.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
ping {{ remote_ip }} -c1 -M do {% if mtu %} -s {{ mtu | int - icmp_overhead_bytes }}{% endif %}
7070
with_items: "{{ network_interfaces }}"
7171
loop_control:
72-
label: "{{ remote_host }} on {{ item }}"
72+
label: "{{ remote_host | default('none', true) }} on {{ item }}"
7373
when:
7474
- remote_hosts | length > 0
7575
- remote_ip | length > 0
@@ -90,6 +90,6 @@
9090
# when check: remote_ip | length > 0, would pass, but remote_ip was ''
9191
# in the command. Assumption was that this was being evaluated once
9292
# for the when clause and then again for the command. Bug?
93-
remote_host: "{{ remote_hosts | random(seed=ansible_facts.date_time.iso8601) }}"
93+
remote_host: "{{ remote_hosts | random(seed=ansible_facts.date_time.iso8601) if remote_hosts | length > 0 else '' }}"
9494
remote_ip: "{{ lookup('cached', 'vars', item ~ '_ips', default={})[remote_host] | default('', true) }}"
9595
mtu: "{{ item | net_mtu }}"

0 commit comments

Comments
 (0)