bundles/powerdns: only reload pdns on zone changes, don't restart
Some checks failed
bundlewrap/pipeline/head There was a failure building this commit

This commit is contained in:
Franzi 2020-10-16 20:40:05 +02:00
parent c5fc67660a
commit 31cc74951b
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -75,6 +75,16 @@ svc_systemd = {
},
}
actions = {
'powerdns_reload_zones': {
'triggered': True,
'command': 'pdns_control rediscover; pdns_control reload',
'needs': {
'svc_systemd:pdns',
},
},
}
if node.metadata['powerdns'].get('features', {}).get('bind', False):
primary_zones = set()
for zone in listdir(zone_path):
@ -97,7 +107,7 @@ if node.metadata['powerdns'].get('features', {}).get('bind', False):
},
'source': 'bind-zones/{}'.format(zone),
'triggers': {
'svc_systemd:pdns:reload',
'action:powerdns_reload_zones',
},
}
@ -106,7 +116,7 @@ if node.metadata['powerdns'].get('features', {}).get('bind', False):
'pkg_apt:pdns-backend-bind',
},
'triggers': {
'svc_systemd:pdns:restart',
'action:powerdns_reload_zones',
},
}
@ -119,7 +129,7 @@ if node.metadata['powerdns'].get('features', {}).get('bind', False):
'pkg_apt:pdns-backend-bind',
},
'triggers': {
'svc_systemd:pdns:reload',
'action:powerdns_reload_zones',
},
}
@ -133,22 +143,20 @@ if node.metadata['powerdns'].get('features', {}).get('pgsql', False):
'pkg_apt:pdns-backend-pgsql',
},
'triggers': {
'svc_systemd:pdns:restart',
'action:powerdns_reload_zones',
},
}
files['/etc/powerdns/schema.pgsql.sql'] = {}
actions = {
'powerdns_load_pgsql_schema': {
'command': 'PGPASSWORD={pw} psql -h 127.0.0.1 -d powerdns -U powerdns -w < /etc/powerdns/schema.pgsql.sql'.format(pw=node.metadata['postgresql']['users']['powerdns']['password']),
'unless': 'sudo -u postgres psql -d powerdns -c "\dt" | grep domains 2>&1 >/dev/null',
'needs': {
'bundle:postgresql',
'file:/etc/powerdns/schema.pgsql.sql',
},
'needed_by': {
'svc_systemd:pdns',
},
}
actions['powerdns_load_pgsql_schema'] = {
'command': 'PGPASSWORD={pw} psql -h 127.0.0.1 -d powerdns -U powerdns -w < /etc/powerdns/schema.pgsql.sql'.format(pw=node.metadata['postgresql']['users']['powerdns']['password']),
'unless': 'sudo -u postgres psql -d powerdns -c "\dt" | grep domains 2>&1 >/dev/null',
'needs': {
'bundle:postgresql',
'file:/etc/powerdns/schema.pgsql.sql',
},
'needed_by': {
'svc_systemd:pdns',
},
}