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): if node.metadata['powerdns'].get('features', {}).get('bind', False):
primary_zones = set() primary_zones = set()
for zone in listdir(zone_path): for zone in listdir(zone_path):
@ -97,7 +107,7 @@ if node.metadata['powerdns'].get('features', {}).get('bind', False):
}, },
'source': 'bind-zones/{}'.format(zone), 'source': 'bind-zones/{}'.format(zone),
'triggers': { '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', 'pkg_apt:pdns-backend-bind',
}, },
'triggers': { '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', 'pkg_apt:pdns-backend-bind',
}, },
'triggers': { 'triggers': {
'svc_systemd:pdns:reload', 'action:powerdns_reload_zones',
}, },
} }
@ -133,14 +143,13 @@ if node.metadata['powerdns'].get('features', {}).get('pgsql', False):
'pkg_apt:pdns-backend-pgsql', 'pkg_apt:pdns-backend-pgsql',
}, },
'triggers': { 'triggers': {
'svc_systemd:pdns:restart', 'action:powerdns_reload_zones',
}, },
} }
files['/etc/powerdns/schema.pgsql.sql'] = {} files['/etc/powerdns/schema.pgsql.sql'] = {}
actions = { actions['powerdns_load_pgsql_schema'] = {
'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']), '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', 'unless': 'sudo -u postgres psql -d powerdns -c "\dt" | grep domains 2>&1 >/dev/null',
'needs': { 'needs': {
@ -151,4 +160,3 @@ if node.metadata['powerdns'].get('features', {}).get('pgsql', False):
'svc_systemd:pdns', 'svc_systemd:pdns',
}, },
} }
}