X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=python%2Fget_initial_configuration_hetzner_server.py;fp=python%2Fget_initial_configuration_hetzner_server.py;h=71583ff1ebeb74ebd63486e3078d59ccc4a50e59;hb=d2c58adb0dfa47a4be23686e231d1a2ebc620b81;hp=0000000000000000000000000000000000000000;hpb=c5465178352d4bce4a4ea01bf03fbc6d6b7e59e8;p=perso%2FImmae%2FProjets%2FPuppet.git diff --git a/python/get_initial_configuration_hetzner_server.py b/python/get_initial_configuration_hetzner_server.py new file mode 100644 index 0000000..71583ff --- /dev/null +++ b/python/get_initial_configuration_hetzner_server.py @@ -0,0 +1,21 @@ +import sys +import json +import hetzner_helper + +instance = sys.argv[-1] +instance = hetzner_helper.get("servers/{}".format(instance))[1]["server"] + +infos = {} +infos["ips"] = { + "v4": { + "ipAddress": instance["public_net"]["ipv4"]["ip"], + "gateway": "172.31.1.1", + }, + "v6": { + "ipAddress": instance["public_net"]["ipv6"]["ip"].split("/")[0], + "gateway": "fe80::1", + "mask": instance["public_net"]["ipv6"]["ip"].split("/")[1], + } + } + +print(json.dumps(infos))