Merge "nodepool-base: use ipv4 ZK addresses if we don't have an ipv6 address"

This commit is contained in:
Zuul 2023-01-15 13:49:50 +00:00 committed by Gerrit Code Review
commit 0aa7dc6a2b

View File

@ -57,6 +57,13 @@
set_fact:
nodepool_config: "{{ nodepool_config_content.content | b64decode | from_yaml }}"
# NOTE(ianw) : 2023-10-12 some nodes, e.g. osuosl, do not have ipv6.
# This determines if we should use the ipv4 or ipv6 address of the ZK
# hosts.
- name: Determine if we should use ipv4 or ipv6 for ZK servers
set_fact:
_public_addr: '{{ "public_v6" if hostvars[inventory_hostname]["public_v6"] is defined else "public_v4" }}'
# Have to run service-zookeeper before service-nodepool
# because we need top populate the fact cache.
# Also, we need IP addresses here because in the gate
@ -64,7 +71,7 @@
- name: Get zk config
set_fact:
zk_hosts:
hosts: "{{ (zk_hosts['hosts']|default([])) + [{'port': '2281', 'host': hostvars[item]['public_v6'] | default(hostvars[item]['ansible_host']) }] }}"
hosts: "{{ (zk_hosts['hosts']|default([])) + [{'port': '2281', 'host': hostvars[item][_public_addr] | default(hostvars[item]['ansible_host']) }] }}"
with_items: '{{ groups["zookeeper"] }}'
- name: Overwrite zookeeper-servers