2020-08-18 13:27:55 +00:00
|
|
|
defaults = {
|
|
|
|
'apt': {
|
|
|
|
'repos': {
|
|
|
|
'nginx': {
|
|
|
|
'items': [
|
2020-08-30 10:06:19 +00:00
|
|
|
'deb http://nginx.org/packages/{os} {os_release} nginx',
|
2020-08-18 13:27:55 +00:00
|
|
|
],
|
2020-03-14 09:56:19 +00:00
|
|
|
},
|
2020-08-18 13:27:55 +00:00
|
|
|
},
|
|
|
|
'unattended-upgrades': {
|
|
|
|
'origins': {
|
2020-08-30 10:06:19 +00:00
|
|
|
'o=nginx,a=stable,l=nginx,c=nginx',
|
2020-04-11 09:25:24 +00:00
|
|
|
},
|
2020-03-14 09:56:19 +00:00
|
|
|
},
|
2020-08-18 13:27:55 +00:00
|
|
|
'packages': {
|
|
|
|
'nginx': {},
|
2020-04-13 07:52:26 +00:00
|
|
|
},
|
2020-08-18 13:27:55 +00:00
|
|
|
},
|
|
|
|
'nginx': {
|
2020-08-30 08:32:29 +00:00
|
|
|
'worker_connections': 768,
|
2020-09-20 12:36:43 +00:00
|
|
|
'use_ssl_for_all_connections': True,
|
2020-08-18 13:27:55 +00:00
|
|
|
},
|
|
|
|
}
|
2020-06-01 08:52:52 +00:00
|
|
|
|
|
|
|
|
2020-08-30 08:32:29 +00:00
|
|
|
@metadata_reactor
|
|
|
|
def worker_processes(metadata):
|
|
|
|
return {
|
|
|
|
'nginx': {
|
|
|
|
'worker_processes': metadata.get('vm/cpu', 2),
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-08-18 13:27:55 +00:00
|
|
|
@metadata_reactor
|
2020-06-01 08:52:52 +00:00
|
|
|
def letsencrypt(metadata):
|
|
|
|
if not node.has_bundle('letsencrypt'):
|
2020-08-18 13:27:55 +00:00
|
|
|
raise DoNotRunAgain
|
2020-06-01 08:52:52 +00:00
|
|
|
|
2020-07-19 08:58:54 +00:00
|
|
|
domains = {}
|
2020-06-01 08:52:52 +00:00
|
|
|
|
2020-08-18 13:27:55 +00:00
|
|
|
for domain in metadata.get('nginx/vhosts', {}).keys():
|
2020-06-01 10:29:16 +00:00
|
|
|
domains[domain] = set()
|
|
|
|
|
2020-07-19 08:58:54 +00:00
|
|
|
return {
|
|
|
|
'letsencrypt': {
|
|
|
|
'domains': domains,
|
|
|
|
'reload_after': {
|
|
|
|
'nginx',
|
|
|
|
},
|
|
|
|
},
|
2020-08-18 13:27:55 +00:00
|
|
|
}
|