mirror of
https://github.com/FAUSheppy/athq-vm-management
synced 2025-12-06 13:51:35 +01:00
20 lines
727 B
Python
20 lines
727 B
Python
import jinja2
|
|
environment = jinja2.Environment(loader=jinja2.FileSystemLoader(searchpath="./templates"))
|
|
|
|
def createMasterHostConfig(vmList):
|
|
template = environment.get_template("icinga_host.conf.j2")
|
|
with open("ansible/files/icinga_master_hosts.conf", "w") as f:
|
|
for vmo in sorted(list(set(vmList))):
|
|
|
|
if not vmo.check:
|
|
continue
|
|
|
|
checkDomains = filter(lambda x: not x.get("nocheck"), vmo.subdomains)
|
|
|
|
websites = [ (s["name"], s.get("url"), [ str(x) for x in s.get("check-expect") or [] ]) for s in checkDomains]
|
|
f.write(template.render(hostname=vmo.hostname, address=vmo.ip, websites=websites))
|
|
|
|
def createMasterServiceConfig(vmList):
|
|
pass
|
|
|