summaryrefslogtreecommitdiffstats
path: root/xci
diff options
context:
space:
mode:
Diffstat (limited to 'xci')
-rwxr-xr-xxci/playbooks/dynamic_inventory.py20
-rw-r--r--xci/playbooks/roles/bootstrap-host/tasks/network_debian.yml8
-rw-r--r--xci/playbooks/roles/bootstrap-host/tasks/network_redhat.yml10
-rw-r--r--xci/playbooks/roles/bootstrap-host/tasks/network_suse.yml10
-rw-r--r--xci/playbooks/roles/bootstrap-host/templates/osa/debian.interface.j212
-rw-r--r--xci/playbooks/roles/bootstrap-host/templates/osa/redhat.interface.j27
-rw-r--r--xci/playbooks/roles/bootstrap-host/templates/osa/suse.interface.j24
-rw-r--r--xci/playbooks/roles/bootstrap-host/templates/osa/suse.routes.j22
8 files changed, 38 insertions, 35 deletions
diff --git a/xci/playbooks/dynamic_inventory.py b/xci/playbooks/dynamic_inventory.py
index 8f498742..552a1337 100755
--- a/xci/playbooks/dynamic_inventory.py
+++ b/xci/playbooks/dynamic_inventory.py
@@ -39,10 +39,15 @@ class XCIInventory(object):
self.opnfv_networks = {}
self.opnfv_networks['opnfv'] = {}
- self.opnfv_networks['opnfv']['admin'] = '172.29.236.10'
- self.opnfv_networks['opnfv']['public'] = '192.168.122.2'
- self.opnfv_networks['opnfv']['private'] = '172.29.240.10'
- self.opnfv_networks['opnfv']['storage'] = '172.29.244.10'
+ self.opnfv_networks['opnfv']['admin'] = {}
+ self.opnfv_networks['opnfv']['admin']['address'] = '172.29.236.10/22'
+ self.opnfv_networks['opnfv']['public'] = {}
+ self.opnfv_networks['opnfv']['public']['address'] = '192.168.122.2/24'
+ self.opnfv_networks['opnfv']['public']['gateway'] = '192.168.122.1'
+ self.opnfv_networks['opnfv']['private'] = {}
+ self.opnfv_networks['opnfv']['private']['address'] = '172.29.240.10/22'
+ self.opnfv_networks['opnfv']['storage'] = {}
+ self.opnfv_networks['opnfv']['storage']['address'] = '172.29.244.10/24'
self.read_pdf_idf()
@@ -95,9 +100,12 @@ class XCIInventory(object):
self.add_hostvar(hostname, 'ansible_host', native_vlan_if[0]['address'])
host_networks[hostname] = {}
# And now record the rest of the information
- for network in idf['idf']['net_config'].keys():
+ for network, ndata in idf['idf']['net_config'].items():
network_interface_num = idf['idf']['net_config'][network]['interface']
- host_networks[hostname][network] = pdf_host_info['interfaces'][int(network_interface_num)]['address']
+ host_networks[hostname][network] = {}
+ host_networks[hostname][network]['address'] = pdf_host_info['interfaces'][int(network_interface_num)]['address'] + "/" + str(ndata['mask'])
+ if 'gateway' in ndata.keys():
+ host_networks[hostname][network]['gateway'] = str(ndata['gateway']) + "/" + str(ndata['mask'])
host_networks.update(self.opnfv_networks)
diff --git a/xci/playbooks/roles/bootstrap-host/tasks/network_debian.yml b/xci/playbooks/roles/bootstrap-host/tasks/network_debian.yml
index 380e4c52..3cac1e22 100644
--- a/xci/playbooks/roles/bootstrap-host/tasks/network_debian.yml
+++ b/xci/playbooks/roles/bootstrap-host/tasks/network_debian.yml
@@ -45,10 +45,10 @@
- { 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", ip: "{{ host_info[inventory_hostname].admin }}", prefix: "255.255.252.0" }
- - { name: "br-vxlan", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}.30", ip: "{{ host_info[inventory_hostname].private }}", prefix: "255.255.252.0" }
- - { name: "br-vlan", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}", ip: "{{ host_info[inventory_hostname].public }}", prefix: "255.255.255.0", gateway: "192.168.122.1" }
- - { name: "br-storage", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}.20", ip: "{{ host_info[inventory_hostname].storage }}", prefix: "255.255.252.0" }
+ - { name: "br-mgmt", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}.10", network: "{{ host_info[inventory_hostname].admin }}" }
+ - { 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 }}"
diff --git a/xci/playbooks/roles/bootstrap-host/tasks/network_redhat.yml b/xci/playbooks/roles/bootstrap-host/tasks/network_redhat.yml
index 9dce50b6..b06a8695 100644
--- a/xci/playbooks/roles/bootstrap-host/tasks/network_redhat.yml
+++ b/xci/playbooks/roles/bootstrap-host/tasks/network_redhat.yml
@@ -17,17 +17,17 @@
- { 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" , ip: "{{ host_info[inventory_hostname].public }}", prefix: 24 }
- - { name: "br-mgmt" , ip: "{{ host_info[inventory_hostname].admin }}", prefix: 22 }
- - { name: "br-storage", ip: "{{ host_info[inventory_hostname].storage }}", prefix: 22 }
- - { name: "br-vxlan" , ip: "{{ host_info[inventory_hostname].private}}", prefix: 22 }
+ - { name: "br-vlan" , network: "{{ host_info[inventory_hostname].public }}" }
+ - { name: "br-mgmt" , network: "{{ host_info[inventory_hostname].admin }}" }
+ - { name: "br-storage", network: "{{ host_info[inventory_hostname].storage }}" }
+ - { name: "br-vxlan" , network: "{{ host_info[inventory_hostname].private }}" }
loop_control:
label: "{{ item.name }}"
- name: Add default route through br-vlan
lineinfile:
path: "/etc/sysconfig/network-scripts/ifcfg-br-vlan"
- line: "GATEWAY=192.168.122.1"
+ line: "GATEWAY={{ host_info[inventory_hostname]['public']['gateway'] | ipaddr('address') }}"
- name: restart network service
service:
diff --git a/xci/playbooks/roles/bootstrap-host/tasks/network_suse.yml b/xci/playbooks/roles/bootstrap-host/tasks/network_suse.yml
index b1059c81..c9c9d83c 100644
--- a/xci/playbooks/roles/bootstrap-host/tasks/network_suse.yml
+++ b/xci/playbooks/roles/bootstrap-host/tasks/network_suse.yml
@@ -17,10 +17,10 @@
- { 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", ip: "{{ host_info[inventory_hostname].admin }}/22" }
- - { name: "br-vxlan", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}.30", ip: "{{ host_info[inventory_hostname].private }}/22" }
- - { name: "br-vlan", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}", ip: "{{ host_info[inventory_hostname].public }}/24" }
- - { name: "br-storage", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}.20", ip: "{{ host_info[inventory_hostname].storage }}/22" }
+ - { name: "br-mgmt", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}.10", network: "{{ host_info[inventory_hostname].admin }}" }
+ - { 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 }}"
@@ -35,7 +35,7 @@
src: "{{ installer_type }}/{{ ansible_os_family | lower }}.routes.j2"
dest: "/etc/sysconfig/network/ifroute-{{ item.name }}"
with_items:
- - { name: "br-vlan", gateway: "192.168.122.1", route: "default" }
+ - { name: "br-vlan", gateway: "{{ host_info[inventory_hostname]['public']['gateway'] }}", route: "default" }
- name: restart network service
service:
diff --git a/xci/playbooks/roles/bootstrap-host/templates/osa/debian.interface.j2 b/xci/playbooks/roles/bootstrap-host/templates/osa/debian.interface.j2
index 56db509b..3eddce45 100644
--- a/xci/playbooks/roles/bootstrap-host/templates/osa/debian.interface.j2
+++ b/xci/playbooks/roles/bootstrap-host/templates/osa/debian.interface.j2
@@ -25,14 +25,12 @@ iface {{ item.name }} inet static
post-down ip link del br-vlan-veth || true
bridge_ports br-vlan-veth
{% endif %}
-{% if item.ip is defined %}
- address {{ item.ip }}
+{% if item.network is defined %}
+ address {{ item.network.address | ipaddr('address') }}
+ netmask {{ item.network.address | ipaddr('netmask') }}
{% endif %}
-{% if item.prefix is defined %}
- netmask {{ item.prefix }}
-{% endif %}
-{% if item.gateway is defined %}
- gateway {{ item.gateway }}
+{% if item.network is defined and item.network.gateway is defined %}
+ gateway {{ item.network.gateway | ipaddr('address') }}
{% 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
index d3364385..fa957764 100644
--- a/xci/playbooks/roles/bootstrap-host/templates/osa/redhat.interface.j2
+++ b/xci/playbooks/roles/bootstrap-host/templates/osa/redhat.interface.j2
@@ -14,9 +14,6 @@ TYPE=Bridge
DELAY=0
STP=off
{% endif %}
-{% if item.ip is defined %}
-IPADDR={{ item.ip }}
-{% endif %}
-{% if item.prefix is defined %}
-PREFIX={{ item.prefix }}
+{% if item.network is defined %}
+IPADDR={{ item.network.address }}
{% 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
index 27b01eb4..70811a09 100644
--- a/xci/playbooks/roles/bootstrap-host/templates/osa/suse.interface.j2
+++ b/xci/playbooks/roles/bootstrap-host/templates/osa/suse.interface.j2
@@ -10,8 +10,8 @@ BRIDGE_FORWARDDELAY='0'
BRIDGE_STP=off
BRIDGE_PORTS={{ item.bridge_ports }}
{% endif %}
-{% if item.ip is defined %}
-IPADDR={{ item.ip }}
+{% 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
index 7c868447..93941fad 100644
--- a/xci/playbooks/roles/bootstrap-host/templates/osa/suse.routes.j2
+++ b/xci/playbooks/roles/bootstrap-host/templates/osa/suse.routes.j2
@@ -1 +1 @@
-{{ item.route }} {{ item.gateway }}
+{{ item.route }} {{ item.gateway | ipaddr('address') }}