Use ansible_host instead of ansible_default_ip* for zk

Our zk config is a little too brittle. Let's just use the inventory
vars instead of detected network facts.

Change-Id: I288990edf587bc8394c9473388a858f46efb0691
This commit is contained in:
Monty Taylor 2020-05-11 12:05:24 -05:00 committed by Jeremy Stanley
parent 2337c7e5c5
commit 15b662b37a
2 changed files with 3 additions and 10 deletions

View File

@ -29,17 +29,8 @@ def main():
zk_hosts = []
try:
for host in p['zk_group']:
hv = p['hostvars'][host]
if hv.get('ansible_default_ipv6'):
address=hv['ansible_default_ipv6']['address']
else:
if 'ansible_default_ipv4' not in hv:
module.fail_json(
msg="No network information facts found",
changed=False)
address=hv['ansible_default_ipv4']['address']
zk_hosts.append(dict(
host=address,
host=p['hostvars'][host]['ansible_host'],
port=2181
))
module.exit_json(hosts=zk_hosts, changed=True)

View File

@ -49,6 +49,8 @@
# 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
# hostnames do not resolve.
- name: Get zk config
make_nodepool_zk_hosts:
hostvars: "{{ hostvars }}"