diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-08-18 13:09:29 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2020-02-17 17:31:09 +0100 |
commit | 367c391a61091817cf34475f91a23ca286eec334 (patch) | |
tree | 616ee3d89d031032681844f5825c9d41eec8e9c0 /python/get_initial_configuration_hetzner_server.py | |
parent | 64d41da73cce0005757ca0f7dd88151f9ba5cf4a (diff) | |
download | Puppet-367c391a61091817cf34475f91a23ca286eec334.tar.gz Puppet-367c391a61091817cf34475f91a23ca286eec334.tar.zst Puppet-367c391a61091817cf34475f91a23ca286eec334.zip |
Add hetzner server scripts
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)) | ||