bundles/nginx: add metadata option to disable https
This commit is contained in:
parent
2ac2982463
commit
d6799088c4
3 changed files with 23 additions and 14 deletions
|
@ -1,8 +1,3 @@
|
|||
# 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'
|
||||
|
||||
directories = {
|
||||
'/etc/nginx/sites': {
|
||||
'purge': True,
|
||||
|
@ -20,12 +15,6 @@ files = {
|
|||
'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',
|
||||
|
@ -41,6 +30,19 @@ svc_systemd = {
|
|||
},
|
||||
}
|
||||
|
||||
if node.metadata['nginx']['use_ssl_for_all_connections']:
|
||||
# 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/sites/000-port80.conf'] = {
|
||||
'source': 'port80.conf',
|
||||
'triggers': {
|
||||
'svc_systemd:nginx:restart',
|
||||
},
|
||||
}
|
||||
|
||||
for domain, config in node.metadata.get('nginx', {}).get('vhosts', {}).items():
|
||||
files['/etc/nginx/sites/{}'.format(domain)] = {
|
||||
'source': 'site_template',
|
||||
|
@ -49,10 +51,11 @@ for domain, config in node.metadata.get('nginx', {}).get('vhosts', {}).items():
|
|||
'domain': domain,
|
||||
**config
|
||||
},
|
||||
'needs': {
|
||||
'action:letsencrypt_update_certificates',
|
||||
},
|
||||
'needs': set(),
|
||||
'triggers': {
|
||||
'svc_systemd:nginx:restart',
|
||||
},
|
||||
}
|
||||
|
||||
if node.metadata['nginx']['use_ssl_for_all_connections']:
|
||||
files['/etc/nginx/sites/{}'.format(domain)]['needs'].add('action:letsencrypt_update_certificates')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue