diff options
Diffstat (limited to 'python/get_initial_configuration_hetzner_server.py')
-rw-r--r-- | python/get_initial_configuration_hetzner_server.py | 21 |
1 files changed, 21 insertions, 0 deletions
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 @@ | |||
1 | import sys | ||
2 | import json | ||
3 | import hetzner_helper | ||
4 | |||
5 | instance = sys.argv[-1] | ||
6 | instance = hetzner_helper.get("servers/{}".format(instance))[1]["server"] | ||
7 | |||
8 | infos = {} | ||
9 | infos["ips"] = { | ||
10 | "v4": { | ||
11 | "ipAddress": instance["public_net"]["ipv4"]["ip"], | ||
12 | "gateway": "172.31.1.1", | ||
13 | }, | ||
14 | "v6": { | ||
15 | "ipAddress": instance["public_net"]["ipv6"]["ip"].split("/")[0], | ||
16 | "gateway": "fe80::1", | ||
17 | "mask": instance["public_net"]["ipv6"]["ip"].split("/")[1], | ||
18 | } | ||
19 | } | ||
20 | |||
21 | print(json.dumps(infos)) | ||