diff --git a/playbooks/roles/nodepool-base/tasks/main.yaml b/playbooks/roles/nodepool-base/tasks/main.yaml index c185c138a4..9f2fde0b63 100644 --- a/playbooks/roles/nodepool-base/tasks/main.yaml +++ b/playbooks/roles/nodepool-base/tasks/main.yaml @@ -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