aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/post-osa
diff options
context:
space:
mode:
authorYifei Xue <xueyifei@huawei.com>2017-11-01 11:46:18 +0800
committerYifei Xue <xueyifei@huawei.com>2017-11-28 21:39:19 +0800
commit10361fd56fac5f7aebba44402bf9a501854d00c3 (patch)
tree205b76c0831e272e71dbef64c3c10ea332f13eea /deploy/adapters/ansible/roles/post-osa
parent9a76ddb1075479c891389a0c9303d80ead9895a0 (diff)
Upgrade OpenStack version from Ocata to Pike
JIRA: COMPASS-565 For OPNFV F release, it's going to use OpenStack Pike as the NFVI component. This task is created to monitor the upgrade work of OpenStack Pike. Subtasks as follow: - Add Pike related configurations to compass_conf - Upgrade ubuntu os to ubuntu 16.04.3 - Upgrade centos os to centos 7.4 - Upgrade openstack-ansible from ocata to pike - Upgrade openstack repos from ocata to pike Change-Id: I2202e8e3ae23dae8e575c89170c9e5e057757870 Signed-off-by: Yifei Xue <xueyifei@huawei.com>
Diffstat (limited to 'deploy/adapters/ansible/roles/post-osa')
-rw-r--r--deploy/adapters/ansible/roles/post-osa/tasks/RedHat.yml79
-rw-r--r--deploy/adapters/ansible/roles/post-osa/tasks/main.yml16
-rw-r--r--deploy/adapters/ansible/roles/post-osa/templates/ifcfg-external.j27
-rw-r--r--deploy/adapters/ansible/roles/post-osa/templates/ifcfg-storage.j27
-rw-r--r--deploy/adapters/ansible/roles/post-osa/templates/ifcfg-tenant.j27
5 files changed, 112 insertions, 4 deletions
diff --git a/deploy/adapters/ansible/roles/post-osa/tasks/RedHat.yml b/deploy/adapters/ansible/roles/post-osa/tasks/RedHat.yml
new file mode 100644
index 00000000..ecfd0680
--- /dev/null
+++ b/deploy/adapters/ansible/roles/post-osa/tasks/RedHat.yml
@@ -0,0 +1,79 @@
+##############################################################################
+# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD 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
+##############################################################################
+---
+
+# yamllint disable rule:line-length
+- name: add eth0 ip addresss
+ lineinfile:
+ dest: /etc/sysconfig/network-scripts/ifcfg-eth0
+ line: "IPADDR={{ ip_settings[inventory_hostname][\"mgmt\"][\"ip\"] }}"
+
+- name: add eth0 netmask
+ lineinfile:
+ dest: /etc/sysconfig/network-scripts/ifcfg-eth0
+ line: "NETMASK=255.255.255.0"
+
+- name: Disable default gw in eth0
+ lineinfile:
+ dest: /etc/sysconfig/network-scripts/ifcfg-eth0
+ line: "DEFROUTE=\"no\""
+
+- name: generate ifcfg-external
+ template:
+ src: ifcfg-external.j2
+ dest: /etc/sysconfig/network-scripts/ifcfg-{{compu_sys_mappings["external"]["interface"]}}
+
+- name: generate ifcfg-storage
+ template:
+ src: ifcfg-storage.j2
+ dest: /etc/sysconfig/network-scripts/ifcfg-{{compu_sys_mappings["storage"]["interface"]}}.{{compu_sys_mappings["storage"]["vlan_tag"]}}
+
+- name: generate ifcfg-tenant
+ template:
+ src: ifcfg-tenant.j2
+ dest: /etc/sysconfig/network-scripts/ifcfg-{{compu_sys_mappings["tenant"]["interface"]}}.{{compu_sys_mappings["tenant"]["vlan_tag"]}}
+
+# yamllint enable rule:line-length
+
+- name: remove ifcfg-br-mgmt script
+ file:
+ path: /etc/sysconfig/network-scripts/ifcfg-br-mgmt
+ state: absent
+
+- name: remove ifcfg-br-external script
+ file:
+ path: /etc/sysconfig/network-scripts/ifcfg-br-external
+ state: absent
+
+- name: remove ifcfg-br-storage script
+ file:
+ path: /etc/sysconfig/network-scripts/ifcfg-br-storage
+ state: absent
+
+- name: remove ifcfg-br-tenant script
+ file:
+ path: /etc/sysconfig/network-scripts/ifcfg-br-tenant
+ state: absent
+
+- name: restart the network
+ shell: systemctl restart network
+
+- name: fix mapping in compute
+ shell: |
+ {% set compute_mappings = [] %}
+ {% for key, value in compu_prv_mappings.iteritems() %}
+ {% set mapping = key + ":" + value["bridge"] %}
+ {% set _ = compute_mappings.append(mapping) %}
+ {% endfor %}
+ {% if compute_mappings | length != 0 %}
+ sed -i "s/^\(bridge_mappings\).*/\1 = {{ ','.join(compute_mappings) }}/g" \
+ /etc/neutron/plugins/ml2/openvswitch_agent.ini
+ {% else %}
+ sed -i "/bridge_mappings/d" /etc/neutron/plugins/ml2/openvswitch_agent.ini
+ {% endif %}
diff --git a/deploy/adapters/ansible/roles/post-osa/tasks/main.yml b/deploy/adapters/ansible/roles/post-osa/tasks/main.yml
index f7f7a6cc..bd83b50f 100644
--- a/deploy/adapters/ansible/roles/post-osa/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/post-osa/tasks/main.yml
@@ -8,10 +8,18 @@
##############################################################################
---
- include: "{{ ansible_distribution }}.yml"
- when: inventory_hostname in groups['compute']
+ when:
+ - inventory_hostname in groups['compute']
+ - ansible_distribution == 'Ubuntu'
# install networking-sfc for non odl scenarios
-- include: install_networking_sfc.yml
+# - include: install_networking_sfc.yml
+# when:
+# - odl_sfc is not defined or odl_sfc == "Disable"
+# - inventory_hostname not in groups['compute']
+# when: ansible_distribution == 'Ubuntu'
+
+- include: "{{ ansible_os_family }}.yml"
when:
- - odl_sfc is not defined or odl_sfc == "Disable"
- - inventory_hostname not in groups['compute']
+ - ansible_os_family == 'RedHat' and ansible_distribution_major_version == '7'
+ - inventory_hostname in groups['compute']
diff --git a/deploy/adapters/ansible/roles/post-osa/templates/ifcfg-external.j2 b/deploy/adapters/ansible/roles/post-osa/templates/ifcfg-external.j2
new file mode 100644
index 00000000..0154b944
--- /dev/null
+++ b/deploy/adapters/ansible/roles/post-osa/templates/ifcfg-external.j2
@@ -0,0 +1,7 @@
+DEVICE={{compu_sys_mappings["external"]["interface"]}}
+ONBOOT=yes
+BOOTPROTO=static
+TYPE=Ethernet
+IPADDR={{ ip_settings[inventory_hostname]["external"]["ip"] }}
+GATEWAY={{ ip_settings[inventory_hostname]["external"]["gw"] }}
+NETMASK=255.255.255.0
diff --git a/deploy/adapters/ansible/roles/post-osa/templates/ifcfg-storage.j2 b/deploy/adapters/ansible/roles/post-osa/templates/ifcfg-storage.j2
new file mode 100644
index 00000000..338da8c4
--- /dev/null
+++ b/deploy/adapters/ansible/roles/post-osa/templates/ifcfg-storage.j2
@@ -0,0 +1,7 @@
+DEVICE={{compu_sys_mappings["storage"]["interface"]}}.{{compu_sys_mappings["storage"]["vlan_tag"]}}
+BOOTPROTO=none
+ONBOOT=yes
+VLAN=yes
+IPADDR={{ ip_settings[inventory_hostname]["storage"]["ip"] }}
+NETMASK=255.255.255.0
+DEFROUTE="no"
diff --git a/deploy/adapters/ansible/roles/post-osa/templates/ifcfg-tenant.j2 b/deploy/adapters/ansible/roles/post-osa/templates/ifcfg-tenant.j2
new file mode 100644
index 00000000..15230c96
--- /dev/null
+++ b/deploy/adapters/ansible/roles/post-osa/templates/ifcfg-tenant.j2
@@ -0,0 +1,7 @@
+DEVICE={{compu_sys_mappings["tenant"]["interface"]}}.{{compu_sys_mappings["tenant"]["vlan_tag"]}}
+BOOTPROTO=none
+ONBOOT=yes
+VLAN=yes
+IPADDR={{ ip_settings[inventory_hostname]["tenant"]["ip"] }}
+NETMASK=255.255.255.0
+DEFROUTE="no"