Move all_services into opentofu
This commit is contained in:
parent
6fdfd338a1
commit
2ad3cce749
10 changed files with 415 additions and 267 deletions
playbooks/filter_plugins
|
@ -10,27 +10,29 @@ class FilterModule(object):
|
|||
for service in services:
|
||||
if service["host"] != host:
|
||||
continue
|
||||
if not attribute in service:
|
||||
|
||||
attribute_value = service.get(attribute)
|
||||
if not attribute_value:
|
||||
continue
|
||||
|
||||
if type(service[attribute]) == list:
|
||||
result.extend(service[attribute])
|
||||
if type(attribute_value) == list:
|
||||
result.extend(attribute_value)
|
||||
else:
|
||||
result.append(service[attribute])
|
||||
result.append(attribute_value)
|
||||
|
||||
return result
|
||||
|
||||
def services_to_dnscontrol(self, services):
|
||||
result = {}
|
||||
for service in services:
|
||||
for dns in service.get("dns", []):
|
||||
name = dns.get("name", service["name"])
|
||||
for dns in service.get("dns") or []:
|
||||
name = dns.get("name") or service["name"]
|
||||
result[name] = {
|
||||
"target": dns["target"],
|
||||
"domain": dns["domain"],
|
||||
}
|
||||
|
||||
if "alias" in dns:
|
||||
if dns.get("alias"):
|
||||
result[name]["alias"] = dns["alias"]
|
||||
else:
|
||||
result[name]["host"] = service["host"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue