summaryrefslogtreecommitdiffstats
path: root/xci
diff options
context:
space:
mode:
Diffstat (limited to 'xci')
-rw-r--r--xci/playbooks/roles/bootstrap-host/tasks/network_debian.yml42
-rw-r--r--xci/playbooks/roles/bootstrap-host/vars/main.yml70
2 files changed, 111 insertions, 1 deletions
diff --git a/xci/playbooks/roles/bootstrap-host/tasks/network_debian.yml b/xci/playbooks/roles/bootstrap-host/tasks/network_debian.yml
index f2a138f8..46f6e81f 100644
--- a/xci/playbooks/roles/bootstrap-host/tasks/network_debian.yml
+++ b/xci/playbooks/roles/bootstrap-host/tasks/network_debian.yml
@@ -51,8 +51,48 @@
- { 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 }}/debian.interface.j2"
+ dest: "/etc/network/interfaces.d/{{ item.name }}.cfg"
+ 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 }}/debian.interface.j2"
+ dest: "/etc/network/interfaces.d/{{ item.name }}.cfg"
+ with_items:
+ - { name: "{{ mgmt_interface }}", vlan_id: "{{ (mgmt_vlan == 'native') | ternary(omit, mgmt_vlan) }}" }
+ - { 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 }}" }
+ loop_control:
+ label: "{{ item.name }}"
+ when:
+ - baremetal | bool == true
+ - "'opnfv' in inventory_hostname"
- name: restart network service
- shell: "/sbin/ifconfig {{ ansible_local.xci.network.xci_interface }} 0 && /sbin/ifdown -a && /sbin/ifup -a"
+ shell: "/sbin/ip addr flush dev {{ item }} && /sbin/ifdown -a && /sbin/ifup -a"
async: 15
poll: 0
+ with_items:
+ - "{{ public_interface }}"
+ - "{{ mgmt_interface }}"
diff --git a/xci/playbooks/roles/bootstrap-host/vars/main.yml b/xci/playbooks/roles/bootstrap-host/vars/main.yml
new file mode 100644
index 00000000..1730ad57
--- /dev/null
+++ b/xci/playbooks/roles/bootstrap-host/vars/main.yml
@@ -0,0 +1,70 @@
+---
+# admin network information
+admin_mac: "{{ host_info[inventory_hostname].admin.mac_address }}"
+admin_interface: >-
+ {% for x in (ansible_interfaces | map('regex_replace', '-', '_') | map('regex_replace', '^', 'ansible_') | map('extract', hostvars[inventory_hostname]) | selectattr('macaddress','defined')) -%}
+ {%- if x.macaddress == admin_mac -%}
+ {%- if admin_vlan == 'native' -%}
+ {{ x.device }}
+ {%- else -%}
+ {{ x.device }}.{{ admin_vlan }}
+ {%- endif -%}
+ {%- endif -%}
+ {%- endfor -%}
+admin_vlan: "{{ host_info[inventory_hostname].admin.vlan }}"
+
+# mgmt network information
+mgmt_mac: "{{ host_info[inventory_hostname].mgmt.mac_address }}"
+mgmt_interface: >-
+ {% for x in (ansible_interfaces | map('regex_replace', '-', '_') | map('regex_replace', '^', 'ansible_') | map('extract', hostvars[inventory_hostname]) | selectattr('macaddress','defined')) -%}
+ {%- if x.macaddress == mgmt_mac -%}
+ {%- if mgmt_vlan == 'native' -%}
+ {{ x.device }}
+ {%- else -%}
+ {{ x.device }}.{{ mgmt_vlan }}
+ {%- endif -%}
+ {%- endif -%}
+ {%- endfor -%}
+mgmt_vlan: "{{ host_info[inventory_hostname].mgmt.vlan }}"
+
+# storage network information
+storage_mac: "{{ host_info[inventory_hostname].storage.mac_address }}"
+storage_interface: >-
+ {%- for x in (ansible_interfaces | map('regex_replace', '-', '_') | map('regex_replace', '^', 'ansible_') | map('extract', hostvars[inventory_hostname]) | selectattr('macaddress','defined')) -%}
+ {%- if x.macaddress == storage_mac -%}
+ {%- if storage_vlan == 'native' -%}
+ {{ x.device }}
+ {%- else -%}
+ {{ x.device }}.{{ storage_vlan }}
+ {%- endif -%}
+ {%- endif -%}
+ {%- endfor -%}
+storage_vlan: "{{ host_info[inventory_hostname].storage.vlan }}"
+
+# public vlan netwrk information
+public_mac: "{{ host_info[inventory_hostname].public.mac_address }}"
+public_interface: >-
+ {%- for x in (ansible_interfaces | map('regex_replace', '-', '_') | map('regex_replace', '^', 'ansible_') | map('extract', hostvars[inventory_hostname]) | selectattr('macaddress','defined')) -%}
+ {%- if x.macaddress == public_mac -%}
+ {%- if public_vlan == 'native' -%}
+ {{ x.device }}
+ {%- else -%}
+ {{ x.device }}.{{ public_vlan }}
+ {%- endif -%}
+ {%- endif -%}
+ {%- endfor -%}
+public_vlan: "{{ host_info[inventory_hostname].public.vlan }}"
+
+# private vxlan network information
+private_mac: "{{ host_info[inventory_hostname].private.mac_address }}"
+private_interface: >-
+ {%- for x in (ansible_interfaces | map('regex_replace', '-', '_') | map('regex_replace', '^', 'ansible_') | map('extract', hostvars[inventory_hostname]) | selectattr('macaddress','defined')) -%}
+ {%- if x.macaddress == private_mac -%}
+ {%- if private_vlan == 'native' -%}
+ {{ x.device }}
+ {%- else -%}
+ {{x.device}}.{{ private_vlan }}
+ {%- endif -%}
+ {%- endif -%}
+ {%- endfor -%}
+private_vlan: "{{ host_info[inventory_hostname].private.vlan }}"