2020-03-14 09:56:19 +00:00
|
|
|
@metadata_processor
|
2020-04-13 07:52:26 +00:00
|
|
|
def defaults(metadata):
|
2020-03-14 09:56:19 +00:00
|
|
|
return {
|
|
|
|
'apt': {
|
|
|
|
'repos': {
|
|
|
|
'nginx': {
|
|
|
|
'key': '573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62',
|
|
|
|
'items': [
|
|
|
|
'deb http://nginx.org/packages/debian buster nginx',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'unattended-upgrades': {
|
2020-05-23 15:01:30 +00:00
|
|
|
'origins': {
|
|
|
|
'o=nginx,a=stable,n=buster,l=nginx,c=nginx',
|
2020-03-14 09:56:19 +00:00
|
|
|
},
|
|
|
|
},
|
2020-04-11 09:25:24 +00:00
|
|
|
'packages': {
|
|
|
|
'nginx': {},
|
|
|
|
},
|
2020-03-14 09:56:19 +00:00
|
|
|
},
|
2020-04-13 07:52:26 +00:00
|
|
|
'nginx': {
|
|
|
|
'worker_processes': 4,
|
|
|
|
'worker_connections': 1000,
|
|
|
|
},
|
2020-03-14 09:56:19 +00:00
|
|
|
}, DEFAULTS, DONE
|
2020-06-01 08:52:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
@metadata_processor
|
|
|
|
def letsencrypt(metadata):
|
|
|
|
if not node.has_bundle('letsencrypt'):
|
|
|
|
return metadata, DONE
|
|
|
|
|
2020-06-01 10:29:16 +00:00
|
|
|
le = metadata.setdefault('letsencrypt', {})
|
|
|
|
domains = le.setdefault('domains', {})
|
2020-06-01 08:52:52 +00:00
|
|
|
|
|
|
|
for domain in metadata.get('nginx', {}).get('vhosts', {}).keys():
|
2020-06-01 10:29:16 +00:00
|
|
|
domains[domain] = set()
|
|
|
|
|
|
|
|
reload = le.setdefault('reload_after', set())
|
|
|
|
reload.add('nginx')
|
2020-06-01 08:52:52 +00:00
|
|
|
|
|
|
|
return metadata, RUN_ME_AGAIN
|