From 3230139d65bbc222228ee1e72ec4d19ac897dfe3 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Tue, 27 Mar 2018 19:53:51 +1100 Subject: [PATCH] Handle blank public_ipv4 Some clouds such as limestone have no public_ipv4; handle this in the firewall setup Change-Id: Id4a8032a6a14a040d62d1c70bf5e6e789fd8ff55 --- roles/multi-node-firewall/tasks/main.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/roles/multi-node-firewall/tasks/main.yaml b/roles/multi-node-firewall/tasks/main.yaml index 201bd2aee..304fd883c 100644 --- a/roles/multi-node-firewall/tasks/main.yaml +++ b/roles/multi-node-firewall/tasks/main.yaml @@ -3,8 +3,12 @@ ipv4_addresses: > {% set hosts = [] -%} {% for host, vars in hostvars.items() -%} - {% set _ = hosts.append(vars['nodepool']['private_ipv4']) -%} - {% set _ = hosts.append(vars['nodepool']['public_ipv4']) -%} + {% if vars['nodepool']['private_ipv4'] -%} + {% set _ = hosts.append(vars['nodepool']['private_ipv4']) -%} + {% endif -%} + {% if vars['nodepool']['public_ipv4'] -%} + {% set _ = hosts.append(vars['nodepool']['public_ipv4']) -%} + {% endif -%} {% endfor -%} {{- hosts | sort | unique -}} ipv6_addresses: >