[baremetal] Provide networking for suse nodes 39/63739/14
authorManuel Buil <mbuil@suse.com>
Fri, 19 Oct 2018 07:43:42 +0000 (09:43 +0200)
committerManuel Buil <mbuil@suse.com>
Tue, 6 Nov 2018 13:15:03 +0000 (13:15 +0000)
When deploying baremetal, the traffic should be segmented using the
different interfaces instead of through vlans. All the config is done
based on idf and pdf information.

When doing non-baremetal, opnfv and nodes get the same config.
When doing baremetal, opnfv and nodes get a different network config

Apart from that, if vlan_id is defined in the name, there is no need
for VLAN_ID in the interface descriptor. This simplifies things

Change-Id: Iddbb90af807b43e247e5ee11fe735df9e823d4bf
Signed-off-by: Manuel Buil <mbuil@suse.com>
xci/playbooks/roles/bootstrap-host/tasks/network_suse.yml
xci/playbooks/roles/bootstrap-host/templates/osa/suse.interface.j2

index 569644b..8e21b40 100644 (file)
     - { name: "br-storage", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}.20", network: "{{ host_info[inventory_hostname].storage }}" }
   loop_control:
     label: "{{ item.name }}"
+  when: baremetal | bool != true
+
+- name: "Configure baremetal networking for blade: {{ inventory_hostname }}"
+  template:
+    src: "{{ installer_type }}/{{ ansible_os_family | lower }}.interface.j2"
+    dest: "/etc/sysconfig/network/ifcfg-{{ item.name }}"
+  with_items:
+    - { name: "{{ admin_interface }}", network: "{{ host_info[inventory_hostname].admin }}" }
+    - { name: "{{ mgmt_interface }}", vlan_id: "{{ (mgmt_vlan == 'native') | ternary(omit, mgmt_vlan) }}" }
+    - { name: "{{ storage_interface }}", vlan_id: "{{ (storage_vlan == 'native') | ternary(omit, storage_vlan) }}" }
+    - { name: "{{ public_interface }}", vlan_id: "{{ (public_vlan == 'native') | ternary(omit, public_vlan) }}" }
+    - { name: "{{ private_interface }}", vlan_id: "{{ (private_vlan == 'native') | ternary(omit, private_vlan) }}" }
+    - { name: "br-mgmt", bridge_ports: "{{ mgmt_interface }}", network: "{{ host_info[inventory_hostname].mgmt }}" }
+    - { name: "br-vxlan", bridge_ports: "{{ private_interface }}", network: "{{ host_info[inventory_hostname].private }}" }
+    - { name: "br-vlan", bridge_ports: "{{ public_interface }}", network: "{{ host_info[inventory_hostname].public }}" }
+    - { name: "br-storage", bridge_ports: "{{ storage_interface }}", network: "{{ host_info[inventory_hostname].storage }}" }
+  loop_control:
+    label: "{{ item.name }}"
+  when:
+    -  baremetal | bool == true
+    - "'opnfv' not in inventory_hostname"
+
+- name: "Configure baremetal networking for VM: {{ inventory_hostname }}"
+  template:
+    src: "{{ installer_type }}/{{ ansible_os_family | lower }}.interface.j2"
+    dest: "/etc/sysconfig/network/ifcfg-{{ item.name }}"
+  with_items:
+    - { name: "{{ mgmt_interface }}", vlan_id: "{{ (mgmt_vlan == 'native') | ternary(omit, mgmt_vlan) }}" }
+    - { name: "{{ mgmt_interface }}.30", vlan_id: 30 }
+    - { name: "{{ mgmt_interface }}.20", vlan_id: 20 }
+    - { name: "{{ public_interface }}", vlan_id: "{{ (public_vlan == 'native') | ternary(omit, public_vlan) }}" }
+    - { name: "br-mgmt", bridge_ports: "{{ mgmt_interface }}", network: "{{ host_info[inventory_hostname].mgmt }}" }
+    - { name: "br-vlan", bridge_ports: "{{ public_interface }}", network: "{{ host_info[inventory_hostname].public }}" }
+    - { name: "br-vxlan", bridge_ports: "{{ mgmt_interface }}.30", network: "{{ host_info[inventory_hostname].private }}" }
+    - { name: "br-storage", bridge_ports: "{{ mgmt_interface }}.20", network: "{{ host_info[inventory_hostname].storage }}" }
+  loop_control:
+    label: "{{ item.name }}"
+  when:
+    - baremetal | bool == true
+    - "'opnfv' in inventory_hostname"
 
 - name: Add postup/postdown scripts on SUSE
   copy:
index 70811a0..7c2929d 100644 (file)
@@ -1,8 +1,7 @@
 STARTMODE='auto'
 BOOTPROTO='static'
 {% if item.vlan_id is defined %}
-ETHERDEVICE={{ ansible_default_ipv4.interface }}
-VLAN_ID={{ item.vlan_id }}
+ETHERDEVICE={{ item.name.split('.')[0] }}
 {% endif %}
 {% if item.bridge_ports is defined %}
 BRIDGE='yes'