bundles/wireguard: better dependency management
This commit is contained in:
parent
7a8d7b630e
commit
e181be3fc6
1 changed files with 6 additions and 1 deletions
|
@ -8,6 +8,11 @@ files = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deps = set()
|
||||||
|
|
||||||
|
if node.has_bundle('apt'):
|
||||||
|
deps.add('pkg_apt:wireguard')
|
||||||
|
|
||||||
health_checks = {}
|
health_checks = {}
|
||||||
for number, (peer, config) in enumerate(sorted(node.metadata.get('wireguard/peers', {}).items())):
|
for number, (peer, config) in enumerate(sorted(node.metadata.get('wireguard/peers', {}).items())):
|
||||||
files[f'/etc/systemd/network/wg{number}.netdev'] = {
|
files[f'/etc/systemd/network/wg{number}.netdev'] = {
|
||||||
|
@ -22,7 +27,7 @@ for number, (peer, config) in enumerate(sorted(node.metadata.get('wireguard/peer
|
||||||
'psk': config['psk'],
|
'psk': config['psk'],
|
||||||
'pubkey': config['pubkey'],
|
'pubkey': config['pubkey'],
|
||||||
},
|
},
|
||||||
'needs': {'pkg_apt:wireguard'} if node.has_bundle('apt') else set(),
|
'needs': deps,
|
||||||
'triggers': {
|
'triggers': {
|
||||||
'svc_systemd:systemd-networkd:restart',
|
'svc_systemd:systemd-networkd:restart',
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue