Add site config

This commit is contained in:
SebClem 2024-09-16 19:47:13 +02:00
parent b06d4143da
commit 41c2a5dfb5
Signed by: sebclem
GPG Key ID: 5A4308F6A359EA50

View File

@ -182,7 +182,7 @@ class ActionModule(ActionBase):
""" """
results = { results = {
"dns_hostnames": dict(), # { provider: [ { hostname:"", domain:"", state: "", target: "" } ] } "dns_hostnames": dict(), # { provider: [ { hostname:"", domain:"", state: "", target: "" } ] }
"sites_config": [], # {site: "xx.fr", upstream: "", upstream_config: [], protected: true, whitelist_local: true, domain: "", tls_cert_dir: ""} "sites_config": [], # {site: "xx.fr", upstream: "", upstream_config: [], protected: true, whitelist_local: true, domain: "", tls_cert_dir: "", site_config: []}
"uptime_config": [] # [{ name:"", url: "", protected: True, state: "" }] "uptime_config": [] # [{ name:"", url: "", protected: True, state: "" }]
} }
failed = False failed = False
@ -210,6 +210,7 @@ class ActionModule(ActionBase):
whitelist_local = loaded_data.get("whitelist_local", False) whitelist_local = loaded_data.get("whitelist_local", False)
tls_cert_dir = loaded_data.get("tls_cert_dir", self.default_tls_cert_dir) tls_cert_dir = loaded_data.get("tls_cert_dir", self.default_tls_cert_dir)
additionnal_hostname = loaded_data.get('additionnal_hostname', []) additionnal_hostname = loaded_data.get('additionnal_hostname', [])
site_config = loaded_data.get('site_config', [])
state = loaded_data.get("state", "present") state = loaded_data.get("state", "present")
uptime_raw_config = loaded_data.get("uptime", dict()) uptime_raw_config = loaded_data.get("uptime", dict())
@ -232,7 +233,8 @@ class ActionModule(ActionBase):
"protected": protected, "protected": protected,
"whitelist_local": whitelist_local, "whitelist_local": whitelist_local,
"tls_cert_dir": tls_cert_dir, "tls_cert_dir": tls_cert_dir,
"health_uri": health_uri "health_uri": health_uri,
"site_config": site_config
}) })
if not dns.get("skip", False): if not dns.get("skip", False):
@ -264,6 +266,8 @@ class ActionModule(ActionBase):
this_whitelist_local = host.get("whitelist_local", whitelist_local) this_whitelist_local = host.get("whitelist_local", whitelist_local)
this_state = host.get('state', state) this_state = host.get('state', state)
this_uptime_raw_config = host.get("uptime", dict()) this_uptime_raw_config = host.get("uptime", dict())
this_site_config = host.get('site_config', [])
full_domain = '{0}.{1}'.format(host.get("hostname"), this_domain) if host.get("hostname") else this_domain full_domain = '{0}.{1}'.format(host.get("hostname"), this_domain) if host.get("hostname") else this_domain
this_upstream_config = host.get("upstream_config") this_upstream_config = host.get("upstream_config")
@ -276,7 +280,8 @@ class ActionModule(ActionBase):
"tls_cert_dir": this_tls_cert_dir, "tls_cert_dir": this_tls_cert_dir,
"protected": this_protected, "protected": this_protected,
"whitelist_local": this_whitelist_local, "whitelist_local": this_whitelist_local,
"health_uri": None "health_uri": None,
"site_config": this_site_config
}) })
if not this_dns.get("skip", dns.get("skip", False)): if not this_dns.get("skip", dns.get("skip", False)):