From e4c4d108f593d8d54ced21c68b83ca17af1d445b Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Thu, 28 Feb 2019 17:26:23 +0000 Subject: [PATCH] Print yaml inventory instructions We need to also add servers to the inventory. Print a snippet to add. Change-Id: I630cc9f68b570b517eba81f23b603d84a019b20a --- launch/dns.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/launch/dns.py b/launch/dns.py index 57d6edb073..6e72e5c621 100755 --- a/launch/dns.py +++ b/launch/dns.py @@ -40,6 +40,7 @@ def print_dns(cloud, server): print_dns_opendev(server.name.rsplit('.', 2)[0], ip4, ip6) else: print_dns_legacy(server, ip4, ip6) + print_inventory_yaml(server, ip4, ip6) def print_dns_opendev(name, ip4, ip6): @@ -99,6 +100,20 @@ def print_legacy_dns(server, ip4, ip6): " --ttl 3600 openstack.org" % ( server.name, ip4)) +def print_inventory_yaml(server, ip4, ip6): + print("\n") + print("Put the following into inventory/openstack.yaml") + print("\n") + print(" {name}:".format(name=server.name)) + print(" ansible_host: {ip}".format(ip=ip6 or ip4)) + print(" location:") + print(" cloud: {cloud}".format(cloud=server.location['cloud'])) + print(" region_name: {region_name}".format( + region_name=server.location['region_name'])) + print(" public_v4: {ip4}".format(ip4=ip4)) + if ip6: + print(" public_v6: {ip6}".format(ip6=ip6)) + def main(): parser = argparse.ArgumentParser()