Change roles to get domain from all_services
This commit is contained in:
parent
6ace704a46
commit
bd6409bcc0
25 changed files with 37 additions and 24 deletions
playbooks/filter_plugins
|
@ -4,6 +4,7 @@ class FilterModule(object):
|
|||
'my_service_attributes': self.my_service_attributes,
|
||||
'services_to_dnscontrol': self.services_to_dnscontrol,
|
||||
'services_get_backups': self.services_get_backups,
|
||||
'service_get_domain': self.service_get_domain,
|
||||
}
|
||||
|
||||
def my_service_attributes(self, services, host, attribute="name"):
|
||||
|
@ -24,6 +25,12 @@ class FilterModule(object):
|
|||
|
||||
return result
|
||||
|
||||
def find_service(self, services, name):
|
||||
for service in services:
|
||||
if service.get("name") == name:
|
||||
return service
|
||||
return None
|
||||
|
||||
def services_get_backups(self, all_services, wanted_services):
|
||||
result = []
|
||||
for service in all_services:
|
||||
|
@ -32,6 +39,12 @@ class FilterModule(object):
|
|||
result.append(backup["name"])
|
||||
return result
|
||||
|
||||
def service_get_domain(self, all_services, wanted_service):
|
||||
if service := self.find_service(all_services, wanted_service):
|
||||
if dns := service.get("dns"):
|
||||
if dns_0 := dns[0]:
|
||||
return dns_0.get("domain")
|
||||
return None
|
||||
|
||||
def services_to_dnscontrol(self, services):
|
||||
result = {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue