Franziska Kunsmann
6e423c24fb
Some checks failed
bundlewrap/pipeline/head There was a failure building this commit
31 lines
813 B
Python
31 lines
813 B
Python
from ipaddress import ip_network
|
|
|
|
assert node.has_bundle('systemd-networkd')
|
|
|
|
network = ip_network(node.metadata['wireguard']['my_ip'], strict=False)
|
|
|
|
files = {
|
|
'/etc/systemd/network/wg0.netdev': {
|
|
'content_type': 'mako',
|
|
'context': {
|
|
'network': f'{network.network_address}/{network.prefixlen}',
|
|
**node.metadata['wireguard'],
|
|
},
|
|
'needs': {
|
|
'pkg_apt:wireguard',
|
|
},
|
|
'triggers': {
|
|
'svc_systemd:systemd-networkd:restart',
|
|
},
|
|
},
|
|
'/usr/local/share/icinga/plugins/check_wireguard_connected': {
|
|
'mode': '0755',
|
|
},
|
|
}
|
|
|
|
if node.has_bundle('pppd'):
|
|
files['/etc/ppp/ip-up.d/reconnect-wireguard'] = {
|
|
'source': 'pppd-ip-up',
|
|
'content_type': 'mako',
|
|
'mode': '0755',
|
|
}
|