aboutsummaryrefslogtreecommitdiff
path: root/python/get_initial_configuration_hetzner_server.py
blob: 71583ff1ebeb74ebd63486e3078d59ccc4a50e59 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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))