aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Nasiadka <mnasiadka@gmail.com>2023-01-13 13:49:55 +0100
committerMichal Nasiadka <mnasiadka@gmail.com>2023-01-13 13:03:31 +0000
commitfb8d77a14619714678889bb683467f6356428b38 (patch)
tree560d873b3f3462e12e8b680fc450a86494af190a
parent10ca82c243c9b2aeb1d2ce9fa5f5e1bad74ca8f1 (diff)
downloadkolla-ansible-fb8d77a14619714678889bb683467f6356428b38.tar.gz
kolla-ansible-fb8d77a14619714678889bb683467f6356428b38.zip
CI: Use nodepool.public_ipv4 if nodepool.private_ipv4 is empty
We've noticed cases where nodepool.private_ipv4 is empty, probably caused by [1] or a change in nodepool provider configuration. [1]: https://review.opendev.org/c/zuul/nodepool/+/862522 Change-Id: Ibeca7d99571d9f6d4d1b90277121d685d73c9a59
-rw-r--r--roles/multi-node-vxlan-overlay/tasks/main.yml17
1 files changed, 9 insertions, 8 deletions
diff --git a/roles/multi-node-vxlan-overlay/tasks/main.yml b/roles/multi-node-vxlan-overlay/tasks/main.yml
index bc77a01c5..6a169a13f 100644
--- a/roles/multi-node-vxlan-overlay/tasks/main.yml
+++ b/roles/multi-node-vxlan-overlay/tasks/main.yml
@@ -6,17 +6,18 @@
- vxlan_interface_name is defined
- vxlan_vni is defined
-# We have had cases where the nodepool private IP address is not assigned,
+- name: Set VXLAN interface facts
+ set_fact:
+ tunnel_local_address: "{{ nodepool.private_ipv4 if nodepool.private_ipv4 | length > 0 else nodepool.public_ipv4 }}"
+
+# We have had cases where the nodepool private or public IP address is not assigned,
# which causes hard to diagnose errors later on. Catch it early.
-- name: Assert that the nodepool private IPv4 address is assigned
+
+- name: Assert that the nodepool private or public IPv4 address is assigned
assert:
- that: nodepool.private_ipv4 in ansible_all_ipv4_addresses
+ that: tunnel_local_address in ansible_all_ipv4_addresses
fail_msg: >-
- The nodepool private IP address {{ nodepool.private_ipv4 }} is not assigned
-
-- name: Set VXLAN interface facts
- set_fact:
- tunnel_local_address: "{{ nodepool.private_ipv4 }}"
+ The nodepool private/public IP address {{ tunnel_local_address }} is not assigned
- name: Create VXLAN interface
become: true