defaults = { 'apt': { 'repos': { 'nginx': { 'items': [ 'deb http://nginx.org/packages/{os} {os_release} nginx', ], }, }, 'unattended-upgrades': { 'origins': { 'o=nginx,a=stable,l=nginx,c=nginx', }, }, 'packages': { 'nginx': {}, }, }, 'nginx': { 'worker_connections': 768, }, } @metadata_reactor def worker_processes(metadata): return { 'nginx': { 'worker_processes': metadata.get('vm/cpu', 2), }, } @metadata_reactor def letsencrypt(metadata): if not node.has_bundle('letsencrypt'): raise DoNotRunAgain domains = {} for domain in metadata.get('nginx/vhosts', {}).keys(): domains[domain] = set() return { 'letsencrypt': { 'domains': domains, 'reload_after': { 'nginx', }, }, }