bundles/powerdns: we don't need the node names of primary nameservers
This commit is contained in:
parent
43bd6b4774
commit
7a3e3ad68f
2 changed files with 21 additions and 7 deletions
|
@ -14,7 +14,8 @@ server-id=${my_hostname}
|
||||||
default-ttl=60
|
default-ttl=60
|
||||||
|
|
||||||
% if is_secondary:
|
% if is_secondary:
|
||||||
# Primary servers: ${', '.join(sorted(my_primary_servers['nodes']))}
|
allow-notify-from=${','.join(sorted(my_primary_servers))}
|
||||||
|
|
||||||
slave=yes
|
slave=yes
|
||||||
superslave=yes
|
superslave=yes
|
||||||
allow-notify-from=${','.join(sorted(my_primary_servers['ips']))}
|
allow-notify-from=${','.join(sorted(my_primary_servers['ips']))}
|
||||||
|
|
|
@ -27,26 +27,39 @@ defaults = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@metadata_reactor
|
||||||
|
def get_ips_of_secondary_nameservers(metadata):
|
||||||
|
if metadata.get('powerdns/is_secondary', False):
|
||||||
|
return {}
|
||||||
|
|
||||||
|
ips = set()
|
||||||
|
for rnode in repo.nodes_in_group('dns'):
|
||||||
|
if rnode.metadata.get('powerdns/is_secondary', False):
|
||||||
|
ips.update({
|
||||||
|
str(ip) for ip in repo.libs.tools.resolve_identifier(repo, rnode.name)
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
'powerdns': {
|
||||||
|
'my_secondary_servers': ips,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
@metadata_reactor
|
@metadata_reactor
|
||||||
def get_ips_of_primary_nameservers(metadata):
|
def get_ips_of_primary_nameservers(metadata):
|
||||||
if not metadata.get('powerdns/is_secondary', False):
|
if not metadata.get('powerdns/is_secondary', False):
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
ips = set()
|
ips = set()
|
||||||
nodes = set()
|
|
||||||
for rnode in repo.nodes_in_group('dns'):
|
for rnode in repo.nodes_in_group('dns'):
|
||||||
if not rnode.metadata.get('powerdns/is_secondary', False):
|
if not rnode.metadata.get('powerdns/is_secondary', False):
|
||||||
ips.update({
|
ips.update({
|
||||||
str(ip) for ip in repo.libs.tools.resolve_identifier(repo, rnode.name)
|
str(ip) for ip in repo.libs.tools.resolve_identifier(repo, rnode.name)
|
||||||
})
|
})
|
||||||
nodes.add(rnode.name)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'powerdns': {
|
'powerdns': {
|
||||||
'my_primary_servers': {
|
'my_primary_servers': ips,
|
||||||
'ips': ips,
|
|
||||||
'nodes': nodes,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue