bundles/systemd-networkd: support vlans
This commit is contained in:
parent
4213b60052
commit
75d86f3339
4 changed files with 47 additions and 1 deletions
|
@ -25,11 +25,31 @@ directories = {
|
|||
# config!
|
||||
for interface, config in node.metadata['interfaces'].items():
|
||||
if config.get('dhcp', False):
|
||||
assert not 'vlans' in config, f'interface {interface} cannot use vlans and dhcp!'
|
||||
template = 'template-iface-dhcp.network'
|
||||
else:
|
||||
template = 'template-iface-nodhcp.network'
|
||||
|
||||
files['/etc/systemd/network/50-iface-{}.network'.format(interface)] = {
|
||||
if '.' in interface:
|
||||
files['/etc/systemd/network/60-iface-{}.netdev'.format(interface)] = {
|
||||
'source': 'template-iface-vlan.netdev',
|
||||
'content_type': 'mako',
|
||||
'context': {
|
||||
'interface': interface,
|
||||
'vlan': interface.split('.')[1],
|
||||
},
|
||||
'needed_by': {
|
||||
'svc_systemd:systemd-networkd',
|
||||
},
|
||||
'triggers': {
|
||||
'svc_systemd:systemd-networkd:restart',
|
||||
},
|
||||
}
|
||||
weight = 61
|
||||
else:
|
||||
weight = 50
|
||||
|
||||
files['/etc/systemd/network/{}-iface-{}.network'.format(weight, interface)] = {
|
||||
'source': template,
|
||||
'content_type': 'mako',
|
||||
'context': {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue