mirror of
https://github.com/FAUSheppy/athq-vm-management
synced 2025-12-06 05:41:35 +01:00
feat: add icinga & ansible file generation
This commit is contained in:
11
main.py
11
main.py
@@ -78,3 +78,14 @@ if __name__ == "__main__":
|
||||
|
||||
# dump icinga master
|
||||
icinga.createMasterHostConfig(vmList)
|
||||
|
||||
# dump ansible
|
||||
with open("./ansible/hosts.ini", "w") as f:
|
||||
env = jinja2.Environment(loader=jinja2.FileSystemLoader(searchpath="./templates"))
|
||||
template = env.get_template("hosts.ini.j2")
|
||||
for vmo in set(vmList):
|
||||
if vmo.ansible:
|
||||
f.write(template.render(hostname=vmo.hostname, ip=vmo.ip))
|
||||
f.write("\n")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user