25 lines
696 B
Python
25 lines
696 B
Python
from os.path import join
|
|
|
|
directories = {
|
|
'/etc/openvpn/client': {
|
|
'mode': '0750',
|
|
'owner': 'openvpn',
|
|
'group': None,
|
|
'purge': True,
|
|
},
|
|
}
|
|
|
|
for fname, config in node.metadata.get('openvpn-client/configs', {}).items():
|
|
files[f'/etc/openvpn/client/{fname}.conf'] = {
|
|
'content': repo.vault.decrypt_file(join('openvpn-client', f'{fname}.conf.vault')),
|
|
'triggers': {
|
|
f'svc_systemd:openvpn-client@{config}:restart',
|
|
} if config.get('running', True) else set(),
|
|
}
|
|
|
|
svc_systemd[f'openvpn-client@{fname}'] = {
|
|
'needs': {
|
|
f'file:/etc/openvpn/client/{fname}.conf',
|
|
},
|
|
**config,
|
|
}
|