diff options
Diffstat (limited to 'xci/playbooks/roles')
4 files changed, 9 insertions, 17 deletions
diff --git a/xci/playbooks/roles/create-vm-nodes/tasks/create_vm.yml b/xci/playbooks/roles/create-vm-nodes/tasks/create_vm.yml index 700c6c72..df019c88 100644 --- a/xci/playbooks/roles/create-vm-nodes/tasks/create_vm.yml +++ b/xci/playbooks/roles/create-vm-nodes/tasks/create_vm.yml @@ -128,9 +128,13 @@ command: get_xml register: vm_xml + - name: Fetch the index for admin network + set_fact: + admin_index: "{{ (vm_name == 'opnfv') | ternary(opnfv_vm_idf.net_config.admin.interface, idf.net_config.admin.interface) | int }}" + - name: Fetch the ip set_fact: - vm_ip: "{%- for interface in item.1.interfaces %}{%- if 'native' in (interface.vlan | string) %}{{ interface.address }}{%- endif %}{%- endfor %}" + vm_ip: "{{ item.1.interfaces[admin_index | int].address }}" # Assumes there is only a single NIC per VM - name: get MAC from vm XML diff --git a/xci/playbooks/roles/create-vm-nodes/tasks/main.yml b/xci/playbooks/roles/create-vm-nodes/tasks/main.yml index c1cee6dc..64857d80 100644 --- a/xci/playbooks/roles/create-vm-nodes/tasks/main.yml +++ b/xci/playbooks/roles/create-vm-nodes/tasks/main.yml @@ -18,7 +18,7 @@ # First we create the opnfv_vm - include_tasks: create_vm.yml - with_indexed_items: "{{ [opnfv_vm] + nodes }}" + with_indexed_items: "{{ [opnfv_vm_pdf] + nodes }}" - name: Start the opnfv vm virt: diff --git a/xci/playbooks/roles/create-vm-nodes/templates/net.xml.j2 b/xci/playbooks/roles/create-vm-nodes/templates/net.xml.j2 index 3c082170..7e372ffe 100644 --- a/xci/playbooks/roles/create-vm-nodes/templates/net.xml.j2 +++ b/xci/playbooks/roles/create-vm-nodes/templates/net.xml.j2 @@ -6,13 +6,9 @@ </nat> </forward> <bridge name='{{ network_interface }}' stp='on' delay='0'/> - <ip address='{{ nodes[0].remote_management.address.split(':')[0] }}' netmask='{{ node_network_netmask }}'> + <ip address='{{ opnfv_vm_pdf.interfaces[opnfv_vm_idf.net_config.admin.interface].gateway }}' netmask='{{ node_network_netmask }}'> <dhcp> - {%- for interface in opnfv_vm.interfaces %} - {%- if 'native' in (interface.vlan | string) %} - <host mac="{{ interface.mac_address }}" ip="{{ interface.address }}"/> - {%- endif %} - {%- endfor %} + <host mac="{{ opnfv_vm_pdf.interfaces[opnfv_vm_idf.net_config.admin.interface].mac_address }}" ip="{{ opnfv_vm_pdf.interfaces[opnfv_vm_idf.net_config.admin.interface].address }}"/> </dhcp> </ip> </network> diff --git a/xci/playbooks/roles/create-vm-nodes/templates/vm.xml.j2 b/xci/playbooks/roles/create-vm-nodes/templates/vm.xml.j2 index 5c235f55..e4e41eda 100644 --- a/xci/playbooks/roles/create-vm-nodes/templates/vm.xml.j2 +++ b/xci/playbooks/roles/create-vm-nodes/templates/vm.xml.j2 @@ -35,19 +35,11 @@ <controller type='ide' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> - {% set native_interfaces = [] %} - {%- for interface in item.1.interfaces %} - {%- if 'native' in (interface.vlan | string) %} - {%- set _ = native_interfaces.append(interface) %} - {%- endif %} - {%- endfor %} - {%- for interface in native_interfaces -%} <interface type='network'> <source network='{{ vm_network }}'/> <model type='{{ vm_nic }}'/> - <mac address='{{ interface.mac_address }}'/> + <mac address='{{ item.1.interfaces[opnfv_vm_idf.net_config.admin.interface].mac_address }}'/> </interface> - {% endfor -%} <input type='mouse' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'/> <video> |