bundlewrap/bundles/nginx/metadata.py
Franziska Kunsmann 5f804ca3be
All checks were successful
bundlewrap/pipeline/head This commit looks good
bundles/letsencrypt: add metadata to reload certificates and services
2020-06-01 12:33:25 +02:00

43 lines
1.1 KiB
Python

@metadata_processor
def defaults(metadata):
return {
'apt': {
'repos': {
'nginx': {
'key': '573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62',
'items': [
'deb http://nginx.org/packages/debian buster nginx',
],
},
},
'unattended-upgrades': {
'origins': {
'o=nginx,a=stable,n=buster,l=nginx,c=nginx',
},
},
'packages': {
'nginx': {},
},
},
'nginx': {
'worker_processes': 4,
'worker_connections': 1000,
},
}, DEFAULTS, DONE
@metadata_processor
def letsencrypt(metadata):
if not node.has_bundle('letsencrypt'):
return metadata, DONE
le = metadata.setdefault('letsencrypt', {})
domains = le.setdefault('domains', {})
for domain in metadata.get('nginx', {}).get('vhosts', {}).keys():
domains[domain] = set()
reload = le.setdefault('reload_after', set())
reload.add('nginx')
return metadata, RUN_ME_AGAIN