summaryrefslogtreecommitdiffstats
path: root/xci/playbooks/roles/bootstrap-host
diff options
context:
space:
mode:
Diffstat (limited to 'xci/playbooks/roles/bootstrap-host')
-rw-r--r--xci/playbooks/roles/bootstrap-host/defaults/main.yml11
-rwxr-xr-xxci/playbooks/roles/bootstrap-host/files/network-config-suse17
-rw-r--r--xci/playbooks/roles/bootstrap-host/handlers/main.yml12
-rw-r--r--xci/playbooks/roles/bootstrap-host/tasks/main.yml15
-rw-r--r--xci/playbooks/roles/bootstrap-host/tasks/network.yml64
-rw-r--r--xci/playbooks/roles/bootstrap-host/tasks/network_debian.yml98
-rw-r--r--xci/playbooks/roles/bootstrap-host/tasks/network_redhat.yml32
-rw-r--r--xci/playbooks/roles/bootstrap-host/tasks/network_suse.yml93
-rw-r--r--xci/playbooks/roles/bootstrap-host/tasks/time.yml30
l---------xci/playbooks/roles/bootstrap-host/templates/kubespray1
-rw-r--r--xci/playbooks/roles/bootstrap-host/templates/osa/debian.interface.j239
-rw-r--r--xci/playbooks/roles/bootstrap-host/templates/osa/redhat.interface.j226
-rw-r--r--xci/playbooks/roles/bootstrap-host/templates/osa/suse.interface.j216
-rw-r--r--xci/playbooks/roles/bootstrap-host/templates/osa/suse.routes.j21
l---------xci/playbooks/roles/bootstrap-host/templates/osh1
-rw-r--r--xci/playbooks/roles/bootstrap-host/vars/main.yml70
16 files changed, 526 insertions, 0 deletions
diff --git a/xci/playbooks/roles/bootstrap-host/defaults/main.yml b/xci/playbooks/roles/bootstrap-host/defaults/main.yml
new file mode 100644
index 00000000..8e5a0e34
--- /dev/null
+++ b/xci/playbooks/roles/bootstrap-host/defaults/main.yml
@@ -0,0 +1,11 @@
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2018 SUSE Linux GmbH and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+configure_network: yes
+configure_time: yes
diff --git a/xci/playbooks/roles/bootstrap-host/files/network-config-suse b/xci/playbooks/roles/bootstrap-host/files/network-config-suse
new file mode 100755
index 00000000..02cdd998
--- /dev/null
+++ b/xci/playbooks/roles/bootstrap-host/files/network-config-suse
@@ -0,0 +1,17 @@
+#!/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
+ brctl addif br-vlan br-vlan-veth
+ else
+ brctl delif br-vlan br-vlan-veth
+ ip link del br-vlan-veth || true
+ fi
+fi
+
diff --git a/xci/playbooks/roles/bootstrap-host/handlers/main.yml b/xci/playbooks/roles/bootstrap-host/handlers/main.yml
new file mode 100644
index 00000000..b9103233
--- /dev/null
+++ b/xci/playbooks/roles/bootstrap-host/handlers/main.yml
@@ -0,0 +1,12 @@
+---
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2018 SUSE Linux GmbH and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+- name: Reload facts
+ setup:
+ filter: ansible_local
diff --git a/xci/playbooks/roles/bootstrap-host/tasks/main.yml b/xci/playbooks/roles/bootstrap-host/tasks/main.yml
new file mode 100644
index 00000000..7d6d259e
--- /dev/null
+++ b/xci/playbooks/roles/bootstrap-host/tasks/main.yml
@@ -0,0 +1,15 @@
+---
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2018 SUSE Linx GmbH and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+- include: network.yml
+ when: configure_network
+
+- include: time.yml
+ when: configure_time
diff --git a/xci/playbooks/roles/bootstrap-host/tasks/network.yml b/xci/playbooks/roles/bootstrap-host/tasks/network.yml
new file mode 100644
index 00000000..a4f260c4
--- /dev/null
+++ b/xci/playbooks/roles/bootstrap-host/tasks/network.yml
@@ -0,0 +1,64 @@
+---
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2017 Ericsson AB and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+- name: ensure glean rules are removed
+ file:
+ path: "/etc/udev/rules.d/99-glean.rules"
+ state: absent
+
+- name: Determine required packages
+ set_fact:
+ network_packages:
+ - bridge-utils
+ - "{{ (ansible_pkg_mgr in ['zypper', 'apt']) | ternary('iproute2', 'iproute') }}"
+ - "{{ (ansible_pkg_mgr == 'apt') | ternary('vlan', 'bridge-utils') }}"
+ - iptables
+
+- name: Ensure networking packages are present
+ package:
+ name: "{{ network_packages }}"
+ state: present
+
+- name: Ensure local facts directory exists
+ file:
+ path: "/etc/ansible/facts.d"
+ state: directory
+
+# NOTE(hwoarang) We have to check all levels of the local fact before we add it
+# otherwise Ansible will fail.
+- name: Record initial active interface
+ ini_file:
+ create: yes
+ section: network
+ state: present
+ option: xci_interface
+ value: "{{ ansible_default_ipv4.interface }}"
+ path: "/etc/ansible/facts.d/xci.fact"
+ when: ansible_local is not defined
+ or (ansible_local is defined and ansible_local.xci is not defined)
+ or (ansible_local is defined and ansible_local.xci is defined and ansible_local.xci.network is not defined)
+ or (ansible_local is defined and ansible_local.xci is defined and ansible_local.xci.network is defined and ansible_local.xci.network.xci_interface is not defined)
+ notify:
+ - Reload facts
+
+- name: Run handlers
+ meta: flush_handlers
+
+- name: "Configure networking on {{ ansible_os_family }}"
+ include_tasks: "network_{{ ansible_os_family | lower }}.yml"
+
+- name: Wait for host to come back to life
+ local_action:
+ module: wait_for
+ host: "{{ ansible_host }}"
+ delay: 15
+ state: started
+ port: 22
+ connect_timeout: 10
+ timeout: 180
diff --git a/xci/playbooks/roles/bootstrap-host/tasks/network_debian.yml b/xci/playbooks/roles/bootstrap-host/tasks/network_debian.yml
new file mode 100644
index 00000000..176c7eb1
--- /dev/null
+++ b/xci/playbooks/roles/bootstrap-host/tasks/network_debian.yml
@@ -0,0 +1,98 @@
+---
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2018 SUSE LINUX GmbH.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+- name: configure modules
+ lineinfile:
+ dest: /etc/modules
+ state: present
+ create: yes
+ line: "8021q"
+
+- name: add modules
+ modprobe:
+ name: 8021q
+ state: present
+
+- name: ensure interfaces.d folder is empty
+ file:
+ state: "{{ item }}"
+ path: "/etc/network/interfaces.d"
+ with_items:
+ - absent
+ - directory
+
+- name: Ensure /etc/interfaces can source additional files
+ copy:
+ content: |
+ auto lo
+ iface lo inet loopback
+ source /etc/network/interfaces.d/*.cfg
+ dest: "/etc/network/interfaces"
+
+- name: "Configure networking for {{ inventory_hostname }}"
+ template:
+ src: "{{ installer_type }}/debian.interface.j2"
+ dest: "/etc/network/interfaces.d/{{ item.name }}.cfg"
+ with_items:
+ - { name: "{{ ansible_local.xci.network.xci_interface }}" }
+ - { name: "{{ ansible_local.xci.network.xci_interface }}.10", vlan_id: 10 }
+ - { name: "{{ ansible_local.xci.network.xci_interface }}.30", vlan_id: 30 }
+ - { name: "{{ ansible_local.xci.network.xci_interface }}.20", vlan_id: 20 }
+ - { name: "br-mgmt", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}.10", network: "{{ host_info[inventory_hostname].mgmt }}" }
+ - { name: "br-vxlan", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}.30", network: "{{ host_info[inventory_hostname].private }}" }
+ - { name: "br-vlan", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}", network: "{{ host_info[inventory_hostname].public }}" }
+ - { 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/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/tasks/network_redhat.yml b/xci/playbooks/roles/bootstrap-host/tasks/network_redhat.yml
new file mode 100644
index 00000000..288fdf65
--- /dev/null
+++ b/xci/playbooks/roles/bootstrap-host/tasks/network_redhat.yml
@@ -0,0 +1,32 @@
+---
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2018 SUSE LINUX GmbH.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+- name: "Configure networking on {{ inventory_hostname }}"
+ template:
+ src: "{{ installer_type }}/{{ ansible_os_family | lower }}.ifcfg.j2"
+ dest: "/etc/sysconfig/network-scripts/ifcfg-{{ item.name }}"
+ with_items:
+ - { name: "{{ ansible_local.xci.network.xci_interface }}" , bridge: "br-vlan" }
+ - { name: "{{ ansible_local.xci.network.xci_interface }}.10", bridge: "br-mgmt" , vlan_id: 10 }
+ - { name: "{{ ansible_local.xci.network.xci_interface }}.20", bridge: "br-storage", vlan_id: 20 }
+ - { name: "{{ ansible_local.xci.network.xci_interface }}.30", bridge: "br-vxlan" , vlan_id: 30 }
+ - { name: "br-vlan" , network: "{{ host_info[inventory_hostname].public }}" }
+ - { name: "br-mgmt" , network: "{{ host_info[inventory_hostname].mgmt }}" }
+ - { name: "br-storage", network: "{{ host_info[inventory_hostname].storage }}" }
+ - { name: "br-vxlan" , network: "{{ host_info[inventory_hostname].private }}" }
+ loop_control:
+ label: "{{ item.name }}"
+
+- name: restart network service
+ service:
+ name: network
+ state: restarted
+ async: 15
+ poll: 0
diff --git a/xci/playbooks/roles/bootstrap-host/tasks/network_suse.yml b/xci/playbooks/roles/bootstrap-host/tasks/network_suse.yml
new file mode 100644
index 00000000..a8f1bf59
--- /dev/null
+++ b/xci/playbooks/roles/bootstrap-host/tasks/network_suse.yml
@@ -0,0 +1,93 @@
+---
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2018 SUSE LINUX GmbH.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+- name: "Configure networking on {{ inventory_hostname }}"
+ template:
+ src: "{{ installer_type }}/{{ ansible_os_family | lower }}.interface.j2"
+ dest: "/etc/sysconfig/network/ifcfg-{{ item.name }}"
+ with_items:
+ - { name: "{{ ansible_local.xci.network.xci_interface }}" }
+ - { name: "{{ ansible_local.xci.network.xci_interface }}.10", vlan_id: 10 }
+ - { name: "{{ ansible_local.xci.network.xci_interface }}.30", vlan_id: 30 }
+ - { name: "{{ ansible_local.xci.network.xci_interface }}.20", vlan_id: 20 }
+ - { name: "br-mgmt", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}.10", network: "{{ host_info[inventory_hostname].mgmt }}" }
+ - { name: "br-vxlan", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}.30", network: "{{ host_info[inventory_hostname].private }}" }
+ - { name: "br-vlan", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}", network: "{{ host_info[inventory_hostname].public }}" }
+ - { 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:
+ src: "network-config-suse"
+ dest: "/etc/sysconfig/network/scripts/network-config-suse"
+ mode: 0755
+
+- name: Configure static DNS on SUSE
+ lineinfile:
+ regexp: '^NETCONFIG_DNS_STATIC_SERVERS=.*'
+ line: "NETCONFIG_DNS_STATIC_SERVERS=\"{{ host_info[inventory_hostname]['public']['dns'] | join(' ') }}\""
+ path: "/etc/sysconfig/network/config"
+ state: present
+ when: host_info[inventory_hostname]['public']['dns'] is defined
+
+- name: Configure routes on SUSE
+ template:
+ src: "{{ installer_type }}/{{ ansible_os_family | lower }}.routes.j2"
+ dest: "/etc/sysconfig/network/ifroute-{{ item.name }}"
+ with_items:
+ - { name: "br-vlan", gateway: "{{ host_info[inventory_hostname]['public']['gateway'] }}", route: "default" }
+
+- name: restart network service
+ service:
+ name: network
+ state: restarted
+ async: 15
+ poll: 0
diff --git a/xci/playbooks/roles/bootstrap-host/tasks/time.yml b/xci/playbooks/roles/bootstrap-host/tasks/time.yml
new file mode 100644
index 00000000..9eca769d
--- /dev/null
+++ b/xci/playbooks/roles/bootstrap-host/tasks/time.yml
@@ -0,0 +1,30 @@
+---
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2017 Ericsson AB and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+- name: install chrony
+ package:
+ name: "chrony"
+ state: present
+- name: restart chrony
+ service:
+ name: "{{ (ansible_pkg_mgr == 'apt') | ternary('chrony', 'chronyd') }}"
+ state: restarted
+- name: synchronize time
+ shell: "chronyc -a 'burst 4/4' && chronyc -a makestep"
+ args:
+ executable: /bin/bash
+ changed_when: True
+ register: chrony_got_time
+ until: chrony_got_time.rc == 0
+ retries: 5
+ delay: 5
+ environment:
+ http_proxy: "{{ lookup('env','http_proxy') }}"
+ https_proxy: "{{ lookup('env','https_proxy') }}"
+ no_proxy: "{{ lookup('env','no_proxy') }}"
diff --git a/xci/playbooks/roles/bootstrap-host/templates/kubespray b/xci/playbooks/roles/bootstrap-host/templates/kubespray
new file mode 120000
index 00000000..f820fd11
--- /dev/null
+++ b/xci/playbooks/roles/bootstrap-host/templates/kubespray
@@ -0,0 +1 @@
+osa \ No newline at end of file
diff --git a/xci/playbooks/roles/bootstrap-host/templates/osa/debian.interface.j2 b/xci/playbooks/roles/bootstrap-host/templates/osa/debian.interface.j2
new file mode 100644
index 00000000..2f976002
--- /dev/null
+++ b/xci/playbooks/roles/bootstrap-host/templates/osa/debian.interface.j2
@@ -0,0 +1,39 @@
+# {{ ansible_managed }}
+
+# Physical interface
+{% if item.bridge_ports is not defined %}
+auto {{ item.name }}
+iface {{ item.name }} inet manual
+{% if item.vlan_id is defined %}
+ vlan-raw-device {{ item.name|replace('.' ~ item.vlan_id, '') }}
+{% endif %}
+
+{% else %}
+auto {{ item.name }}
+iface {{ item.name }} inet static
+ bridge_stp off
+ bridge_waitport 0
+ bridge_fd 0
+ bridge_ports {{ item.bridge_ports }}
+{% if item.name == 'br-vlan' %}
+ # Create veth pair, don't bomb if already exists
+ pre-up ip link add br-vlan-veth type veth peer name eth12 || true
+ # Set both ends UP
+ pre-up ip link set br-vlan-veth up
+ pre-up ip link set eth12 up
+ # Delete veth pair on DOWN
+ post-down ip link del br-vlan-veth || true
+ bridge_ports br-vlan-veth
+{% endif %}
+{% if item.network is defined %}
+ address {{ item.network.address | ipaddr('address') }}
+ netmask {{ item.network.address | ipaddr('netmask') }}
+{% endif %}
+{% if item.network is defined and item.network.gateway is defined %}
+ gateway {{ item.network.gateway | ipaddr('address') }}
+{% endif %}
+{% if item.network is defined and item.network.dns is defined %}
+ dns-nameservers {{ item.network.dns | join(' ') }}
+{% endif %}
+
+{% endif %}
diff --git a/xci/playbooks/roles/bootstrap-host/templates/osa/redhat.interface.j2 b/xci/playbooks/roles/bootstrap-host/templates/osa/redhat.interface.j2
new file mode 100644
index 00000000..525686d9
--- /dev/null
+++ b/xci/playbooks/roles/bootstrap-host/templates/osa/redhat.interface.j2
@@ -0,0 +1,26 @@
+DEVICE={{ item.name }}
+NM_CONTROLLED=no
+ONBOOT=yes
+BOOTPROTO=none
+{% if item.vlan_id is defined %}
+VLAN=yes
+ETHERDEVICE={{ ansible_local.xci.network.xci_interface }}
+VLAN_ID={{ item.vlan_id }}
+{% endif %}
+{% if item.bridge is not defined %}
+BRIDGE={{ item.bridge }}
+{% else %}
+TYPE=Bridge
+DELAY=0
+STP=off
+{% endif %}
+{% if item.network is defined %}
+IPADDR={{ item.network.address }}
+{% endif %}
+{% if item.network is defined and item.network.gateway is defined %}
+GATEWAY="{{ host_info[inventory_hostname]['public']['gateway'] | ipaddr('address') }}"
+{% endif %}
+{% if item.network is defined and item.network.dns is defined %}
+DNS="{{ host_info[inventory_hostname]['public']['dns'] | join(' ') }}"
+{% endif %}
+{% endif %}
diff --git a/xci/playbooks/roles/bootstrap-host/templates/osa/suse.interface.j2 b/xci/playbooks/roles/bootstrap-host/templates/osa/suse.interface.j2
new file mode 100644
index 00000000..7c2929d6
--- /dev/null
+++ b/xci/playbooks/roles/bootstrap-host/templates/osa/suse.interface.j2
@@ -0,0 +1,16 @@
+STARTMODE='auto'
+BOOTPROTO='static'
+{% if item.vlan_id is defined %}
+ETHERDEVICE={{ item.name.split('.')[0] }}
+{% endif %}
+{% if item.bridge_ports is defined %}
+BRIDGE='yes'
+BRIDGE_FORWARDDELAY='0'
+BRIDGE_STP=off
+BRIDGE_PORTS={{ item.bridge_ports }}
+{% endif %}
+{% if item.network is defined %}
+IPADDR={{ item.network.address }}
+{% endif %}
+PRE_UP_SCRIPT="compat:suse:network-config-suse"
+POST_DOWN_SCRIPT="compat:suse:network-config-suse"
diff --git a/xci/playbooks/roles/bootstrap-host/templates/osa/suse.routes.j2 b/xci/playbooks/roles/bootstrap-host/templates/osa/suse.routes.j2
new file mode 100644
index 00000000..93941fad
--- /dev/null
+++ b/xci/playbooks/roles/bootstrap-host/templates/osa/suse.routes.j2
@@ -0,0 +1 @@
+{{ item.route }} {{ item.gateway | ipaddr('address') }}
diff --git a/xci/playbooks/roles/bootstrap-host/templates/osh b/xci/playbooks/roles/bootstrap-host/templates/osh
new file mode 120000
index 00000000..f820fd11
--- /dev/null
+++ b/xci/playbooks/roles/bootstrap-host/templates/osh
@@ -0,0 +1 @@
+osa \ No newline at end of file
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 }}"