Skip to content

Commit 2615a4b

Browse files
myukselenhg8496
authored andcommitted
give group alias to label_value so that ansible inventory usage can be streamlined
1 parent fa529ed commit 2615a4b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

hcloud.ini

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,8 @@
77
# This is useful in case you're having hosts inside a private net which you're not able to reach by their public address.
88
#use_private_ip=yes
99
# If you've got multiple private nets and want to ip address of a specific net, set the index number of the net here
10-
#private_net_index=0
10+
#private_net_index=0
11+
12+
[hcloud.groupaliases]
13+
dnsservers = dns_true
14+
webservers = web_true

hcloud.py

+6
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ def main():
6969
break
7070
else:
7171
page += 1
72+
73+
if config.has_section('hcloud.groupaliases'):
74+
for groupalias, label_value in config.items('hcloud.groupaliases'):
75+
if label_value in root:
76+
root[groupalias] = root[label_value]
77+
7278
print(json.dumps(root))
7379

7480

0 commit comments

Comments
 (0)