Franziska Kunsmann
d1236d6e25
All checks were successful
bundlewrap/pipeline/head This commit looks good
49 lines
1.2 KiB
Python
49 lines
1.2 KiB
Python
# TODO rework this to support specifying a certificate instead of
|
|
# relying on letsencrypt for the specific domain (for example to
|
|
# support wildcard certificates
|
|
assert node.has_bundle('letsencrypt'), 'nginx needs letsencrypt'
|
|
|
|
files = {
|
|
'/etc/nginx/nginx.conf': {
|
|
'content_type': 'mako',
|
|
'context': node.metadata['nginx'],
|
|
'triggers': {
|
|
'svc_systemd:nginx:restart',
|
|
},
|
|
},
|
|
'/etc/nginx/sites/000-port80.conf': {
|
|
'source': 'port80.conf',
|
|
'triggers': {
|
|
'svc_systemd:nginx:restart',
|
|
},
|
|
},
|
|
'/etc/nginx/sites/stub_status': {
|
|
'triggers': {
|
|
'svc_systemd:nginx:restart',
|
|
},
|
|
},
|
|
}
|
|
|
|
svc_systemd = {
|
|
'nginx': {
|
|
'needs': {
|
|
'pkg_apt:nginx',
|
|
},
|
|
},
|
|
}
|
|
|
|
for domain, config in node.metadata.get('nginx', {}).get('vhosts', {}).items():
|
|
files['/etc/nginx/sites/{}'.format(domain)] = {
|
|
'source': 'site_template',
|
|
'content_type': 'mako',
|
|
'context': {
|
|
'domain': domain,
|
|
**config
|
|
},
|
|
'needs': {
|
|
'action:letsencrypt_update_certificates',
|
|
},
|
|
'triggers': {
|
|
'svc_systemd:nginx:restart',
|
|
},
|
|
}
|