diff --git a/bundles/systemd-networkd/items.py b/bundles/systemd-networkd/items.py index f5f54cb..42f7832 100644 --- a/bundles/systemd-networkd/items.py +++ b/bundles/systemd-networkd/items.py @@ -41,7 +41,7 @@ for interface, config in node.metadata['interfaces'].items(): if '.' in interface: vlan_id = int(interface.split('.')[1]) vlan_hex = '%02x' % (vlan_id % 255) - files[f'/etc/systemd/network/{interface}.netdev'] = { + files['/etc/systemd/network/60-iface-{}.netdev'.format(interface)] = { 'source': 'template-iface-vlan.netdev', 'content_type': 'mako', 'context': { @@ -56,9 +56,12 @@ for interface, config in node.metadata['interfaces'].items(): 'svc_systemd:systemd-networkd:restart', }, } + weight = 61 + else: + weight = 50 if not config.get('ignore', False): - files[f'/etc/systemd/network/{interface}.network'] = { + files['/etc/systemd/network/{}-iface-{}.network'.format(weight, interface)] = { 'source': template, 'content_type': 'mako', 'context': { @@ -74,7 +77,7 @@ for interface, config in node.metadata['interfaces'].items(): } for bond, config in node.metadata.get('systemd-networkd/bonds', {}).items(): - files[f'/etc/systemd/network/{bond}.netdev'] = { + files['/etc/systemd/network/20-bond-{}.netdev'.format(bond)] = { 'source': 'template-bond.netdev', 'content_type': 'mako', 'context': { @@ -89,7 +92,7 @@ for bond, config in node.metadata.get('systemd-networkd/bonds', {}).items(): 'svc_systemd:systemd-networkd:restart', }, } - files[f'/etc/systemd/network/{bond}.network'] = { + files['/etc/systemd/network/21-bond-{}.network'.format(bond)] = { 'source': 'template-bond.network', 'content_type': 'mako', 'context': { @@ -106,7 +109,7 @@ for bond, config in node.metadata.get('systemd-networkd/bonds', {}).items(): } for brname, config in node.metadata.get('systemd-networkd/bridges', {}).items(): - files[f'/etc/systemd/network/{brname}.netdev'] = { + files['/etc/systemd/network/30-bridge-{}.netdev'.format(brname)] = { 'source': 'template-bridge.netdev', 'content_type': 'mako', 'context': { @@ -119,7 +122,7 @@ for brname, config in node.metadata.get('systemd-networkd/bridges', {}).items(): 'svc_systemd:systemd-networkd:restart', }, } - files[f'/etc/systemd/network/{brname}.network'] = { + files['/etc/systemd/network/31-bridge-{}.network'.format(brname)] = { 'source': 'template-bridge.network', 'content_type': 'mako', 'context': {