78 lines
1.7 KiB
Python
78 lines
1.7 KiB
Python
|
pkg_apt = {
|
||
|
'apt-transport-https': {},
|
||
|
|
||
|
'build-essential': {},
|
||
|
'curl': {},
|
||
|
'git': {},
|
||
|
'grep': {},
|
||
|
'gzip': {},
|
||
|
'htop': {},
|
||
|
'jq': {},
|
||
|
'less': {},
|
||
|
'mtr': {},
|
||
|
'ncdu': {},
|
||
|
'netcat': {},
|
||
|
'python3': {},
|
||
|
'python3-dev': {},
|
||
|
'python3-pip': {},
|
||
|
'python3-virtualenv': {},
|
||
|
'rsync': {},
|
||
|
'tar': {},
|
||
|
'tmux': {},
|
||
|
'tree': {},
|
||
|
'wget': {},
|
||
|
}
|
||
|
|
||
|
if node.metadata.get('apt', {}).get('packages', {}):
|
||
|
for package, options in node.metadata['apt']['packages'].items():
|
||
|
pkg_apt[package] = options
|
||
|
|
||
|
actions = {
|
||
|
'systemd-reload': {
|
||
|
'command': 'systemctl daemon-reload',
|
||
|
'cascade_skip': False,
|
||
|
'triggered': True,
|
||
|
'needed_by': {
|
||
|
'svc_systemd:',
|
||
|
},
|
||
|
},
|
||
|
}
|
||
|
|
||
|
directories = {
|
||
|
'/etc/nginx/sites-enabled': {
|
||
|
'purge': True,
|
||
|
'triggers': {
|
||
|
'svc_systemd:nginx:restart',
|
||
|
},
|
||
|
},
|
||
|
}
|
||
|
|
||
|
for vhost, config in node.metadata.get('nginx', {}).get('vhosts', {}).items():
|
||
|
if not 'domain' in config:
|
||
|
config['domain'] = vhost
|
||
|
|
||
|
files['/etc/nginx/sites-available/{}'.format(vhost)] = {
|
||
|
'source': 'site_template',
|
||
|
'content_type': 'mako',
|
||
|
'context': {
|
||
|
'vhost': vhost,
|
||
|
**config,
|
||
|
},
|
||
|
'triggers': {
|
||
|
'svc_systemd:nginx:restart',
|
||
|
},
|
||
|
}
|
||
|
symlinks['/etc/nginx/sites-enabled/{}'.format(vhost)] = {
|
||
|
'target': '/etc/nginx/sites-available/{}'.format(vhost),
|
||
|
'triggers': {
|
||
|
'svc_systemd:nginx:restart',
|
||
|
},
|
||
|
}
|
||
|
|
||
|
if not 'webroot' in config:
|
||
|
directories['/var/www/{}'.format(vhost)] = config.get('webroot_config', {})
|
||
|
|
||
|
svc_systemd = {
|
||
|
'nginx': {},
|
||
|
}
|