diff --git a/playbooks/library/network_metadata.py b/playbooks/library/network_metadata.py index 355dd79ad..2c912bcb1 100644 --- a/playbooks/library/network_metadata.py +++ b/playbooks/library/network_metadata.py @@ -31,6 +31,7 @@ def main(): ipv4_interface_mac=dict(required=False), ipv4_nameserver=dict(required=False), ipv4_subnet_mask=dict(required=False), + vlan_id=dict(required=False), network_mtu=dict(required=False), nics=dict(required=False), node_network_info=dict(required=False) @@ -70,6 +71,18 @@ def main(): }) else: for i, nic in enumerate(module.params['nics']): + nic_id = nic['mac'] + if module.params['vlan_id']: + nic_id = 'vlan-%s' % nic['mac'] + + links.append({ + 'id': nic_id, + 'type': 'vlan', + 'vlan_id': module.params['vlan_id'], + 'vlan_link': nic['mac'], + 'vlan_mac_address': nic['mac'] + }) + links.append({ 'id': nic['mac'], 'type': 'phy', @@ -79,8 +92,8 @@ def main(): if i == 0: networks.append({ - 'id': 'ipv4-%s' % nic['mac'], - 'link': nic['mac'], + 'id': 'ipv4-%s' % nic_id, + 'link': nic_id, 'type': 'ipv4', 'ip_address': module.params['ipv4_address'], 'netmask': module.params['ipv4_subnet_mask'], @@ -95,8 +108,8 @@ def main(): }) else: networks.append({ - 'id': 'ipv4-dhcp-%s' % nic['mac'], - 'link': nic['mac'], + 'id': 'ipv4-dhcp-%s' % nic_id, + 'link': nic_id, 'type': 'ipv4_dhcp', }) diff --git a/playbooks/roles/bifrost-configdrives-dynamic/tasks/main.yml b/playbooks/roles/bifrost-configdrives-dynamic/tasks/main.yml index c733a0ced..5c22f6a39 100644 --- a/playbooks/roles/bifrost-configdrives-dynamic/tasks/main.yml +++ b/playbooks/roles/bifrost-configdrives-dynamic/tasks/main.yml @@ -37,6 +37,7 @@ ipv4_interface_mac: "{{ ipv4_interface_mac | default('') }}" ipv4_nameserver: "{{ ipv4_nameserver }}" ipv4_subnet_mask: "{{ ipv4_subnet_mask }}" + vlan_id: "{{ vlan_id | default('') }}" network_mtu: "{{ network_mtu }}" nics: "{{ nics }}" node_network_info: "{{ node_network_info | default('') }}"