Merge "nodepool-base: prefer ZK IPv6 addresses"

This commit is contained in:
Zuul 2021-04-22 02:32:20 +00:00 committed by Gerrit Code Review
commit 4930d44311

View File

@ -29,8 +29,15 @@ def main():
zk_hosts = [] zk_hosts = []
try: try:
for host in p['zk_group']: for host in p['zk_group']:
# Prefer public_v6 if set, otherwise ansible_host
addr = None
if 'public_v6' in p['hostvars'][host]:
addr = p['hostvars'][host]['public_v6']
if not addr:
addr = p['hostvars'][host]['ansible_host']
zk_hosts.append(dict( zk_hosts.append(dict(
host=p['hostvars'][host]['ansible_host'], host=addr,
port=2281 port=2281
)) ))
module.exit_json(hosts=zk_hosts, changed=True) module.exit_json(hosts=zk_hosts, changed=True)