summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xxci/playbooks/roles/configure-network/files/network-config-suse15
-rw-r--r--xci/playbooks/roles/configure-network/tasks/main.yml49
-rw-r--r--xci/playbooks/roles/configure-network/templates/suse/suse.interface.j217
-rw-r--r--xci/playbooks/roles/configure-network/templates/suse/suse.routes.j21
-rw-r--r--xci/var/Suse.yml3
5 files changed, 79 insertions, 6 deletions
diff --git a/xci/playbooks/roles/configure-network/files/network-config-suse b/xci/playbooks/roles/configure-network/files/network-config-suse
new file mode 100755
index 00000000..1a9f1e7d
--- /dev/null
+++ b/xci/playbooks/roles/configure-network/files/network-config-suse
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+INTERFACE=$1
+ACTION=$4
+
+if [[ $INTERFACE == "br-vlan" ]]; then
+ if [[ $ACTION == "pre-up" ]]; then
+ ip link add br-vlan-veth type veth peer name eth12 || true
+ ip link set br-vlan-veth up
+ ip link set eth12 up
+ else
+ ip link del br-vlan-veth || true
+ fi
+fi
+
diff --git a/xci/playbooks/roles/configure-network/tasks/main.yml b/xci/playbooks/roles/configure-network/tasks/main.yml
index df1580e5..126389d8 100644
--- a/xci/playbooks/roles/configure-network/tasks/main.yml
+++ b/xci/playbooks/roles/configure-network/tasks/main.yml
@@ -7,7 +7,11 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-# TODO: this role needs to be adjusted for different distros
+- name: ensure glean rules are removed
+ file:
+ path: "/etc/udev/rules.d/99-glean.rules"
+ state: absent
+
- block:
- name: configure modules
lineinfile:
@@ -19,10 +23,6 @@
modprobe:
name: 8021q
state: present
- - name: ensure glean rules are removed
- file:
- path: "/etc/udev/rules.d/99-glean.rules"
- state: absent
- name: ensure interfaces.d folder is empty
shell: "/bin/rm -rf /etc/network/interfaces.d/*"
- name: ensure interfaces file is updated
@@ -32,3 +32,42 @@
- name: restart network service
shell: "/sbin/ifconfig {{ interface }} 0 && /sbin/ifdown -a && /sbin/ifup -a"
when: ansible_os_family | lower == "debian"
+
+- block:
+ - name: Remove existing network configuration
+ file:
+ path: "/etc/sysconfig/network/{{ item }}"
+ state: absent
+ with_items:
+ - "ifcfg-eth0"
+ - "ifroute-eth0"
+
+ - name: Configure networking on SUSE
+ template:
+ src: "{{ ansible_os_family | lower }}/suse.interface.j2"
+ dest: "/etc/sysconfig/network/ifcfg-{{ item.name }}"
+ with_items:
+ - { name: "{{ interface }}" }
+ - { name: "{{ interface }}.10", vlan_id: 10 }
+ - { name: "{{ interface }}.30", vlan_id: 30 }
+ - { name: "{{ interface }}.20", vlan_id: 20 }
+ - { name: "br-mgmt", bridge_ports: "{{ interface }}.10", ip: "{{ host_info[inventory_hostname].MGMT_IP }}/22" }
+ - { name: "br-vxlan", bridge_ports: "{{ interface }}.30", ip: "{{ host_info[inventory_hostname].VXLAN_IP }}/22" }
+ - { name: "br-vlan", bridge_ports: "{{ interface }}", ip: "{{ host_info[inventory_hostname].VLAN_IP }}/24" }
+ - { name: "br-storage", bridge_ports: "{{ interface }}.20", ip: "{{ host_info[inventory_hostname].STORAGE_IP }}/22" }
+
+ - name: Add postup/postdown scripts on SUSE
+ copy:
+ src: "network-config-suse"
+ dest: "/etc/sysconfig/network/scripts/network-config-suse"
+
+ - name: Configure routes on SUSE
+ template:
+ src: "{{ ansible_os_family | lower }}/suse.routes.j2"
+ dest: "/etc/sysconfig/network/ifroute-{{ item.name }}"
+ with_items:
+ - { name: "br-vlan", gateway: "192.168.122.1", route: "default" }
+
+ - name: restart network service
+ shell: "/usr/sbin/wicked ifreload all"
+ when: ansible_os_family | lower == "suse"
diff --git a/xci/playbooks/roles/configure-network/templates/suse/suse.interface.j2 b/xci/playbooks/roles/configure-network/templates/suse/suse.interface.j2
new file mode 100644
index 00000000..ffa418d4
--- /dev/null
+++ b/xci/playbooks/roles/configure-network/templates/suse/suse.interface.j2
@@ -0,0 +1,17 @@
+STARTMODE='auto'
+BOOTPROTO='static'
+{% if item.vlan_id is defined %}
+ETHERDEVICE={{ interface }}
+VLAN_ID={{ item.vlan_id }}
+{% endif %}
+{% if item.bridge_ports is defined %}
+BRIDGE='yes'
+BRIDGE_FORWARDDELAY='0'
+BRIDGE_STP=off
+BRIDGE_PORTS={{ item.bridge_ports }}
+{% endif %}
+{% if item.ip is defined %}
+IPADDR={{ item.ip }}
+{% endif %}
+PRE_UP_SCRIPT="compat:suse:network-config-suse"
+POST_DOWN_SCRIPT="compat:suse:network-config-suse"
diff --git a/xci/playbooks/roles/configure-network/templates/suse/suse.routes.j2 b/xci/playbooks/roles/configure-network/templates/suse/suse.routes.j2
new file mode 100644
index 00000000..7c868447
--- /dev/null
+++ b/xci/playbooks/roles/configure-network/templates/suse/suse.routes.j2
@@ -0,0 +1 @@
+{{ item.route }} {{ item.gateway }}
diff --git a/xci/var/Suse.yml b/xci/var/Suse.yml
index 9674ed2d..786a8751 100644
--- a/xci/var/Suse.yml
+++ b/xci/var/Suse.yml
@@ -7,5 +7,6 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-# this is placeholder and left blank intentionally to complete later on
+# this is the interface the VM nodes are connected to libvirt network "default"
+interface: "eth0"
python_crypto_package_name: python-pycrypto