summaryrefslogtreecommitdiffstats
path: root/xci/playbooks/roles/configure-network/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'xci/playbooks/roles/configure-network/tasks')
-rw-r--r--xci/playbooks/roles/configure-network/tasks/main.yml49
1 files changed, 44 insertions, 5 deletions
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"