aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/onos_cluster
diff options
context:
space:
mode:
authorliyuenan <liyuenan@huawei.com>2016-12-27 17:44:34 +0800
committerliyuenan <liyuenan@huawei.com>2017-01-05 09:42:35 +0800
commit92f6ca7bb6d7b2f295406aab34094b1dba76ff94 (patch)
treec4e62927a3bf9862f7ba9ce286cbece2c4335ef4 /deploy/adapters/ansible/roles/onos_cluster
parent6072a49adb33f2bce3f48b9c7b8be7d96cf8501c (diff)
Yamllint test
JIRA: COMPASS-516 Change-Id: I482ce9bc86f4f963258c5b8823e0b00e83556eef Signed-off-by: liyuenan <liyuenan@huawei.com>
Diffstat (limited to 'deploy/adapters/ansible/roles/onos_cluster')
-rwxr-xr-xdeploy/adapters/ansible/roles/onos_cluster/tasks/main.yml10
-rwxr-xr-xdeploy/adapters/ansible/roles/onos_cluster/tasks/onos_controller.yml70
-rwxr-xr-xdeploy/adapters/ansible/roles/onos_cluster/tasks/openvswitch.yml39
-rwxr-xr-xdeploy/adapters/ansible/roles/onos_cluster/vars/main.yml26
4 files changed, 100 insertions, 45 deletions
diff --git a/deploy/adapters/ansible/roles/onos_cluster/tasks/main.yml b/deploy/adapters/ansible/roles/onos_cluster/tasks/main.yml
index c8ce1155..37f689f6 100755
--- a/deploy/adapters/ansible/roles/onos_cluster/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/onos_cluster/tasks/main.yml
@@ -14,24 +14,24 @@
update-rc.d neutron-plugin-openvswitch-agent remove;
sed -i /neutron-plugin-openvswitch-agent/d /opt/service
when: groups['onos']|length !=0
- ignore_errors: True
+ ignore_errors: "True"
- name: shut down and disable Neutron's agent services
service: name=neutron-plugin-openvswitch-agent state=stopped
when: groups['onos']|length !=0
- ignore_errors: True
+ ignore_errors: "True"
- name: remove neutron-l3-agent auto start
shell: >
update-rc.d neutron-l3-agent remove;
sed -i /neutron-l3-agent/d /opt/service
when: inventory_hostname in groups['onos']
- ignore_errors: True
+ ignore_errors: "True"
- name: shut down and disable Neutron's l3 agent services
service: name=neutron-l3-agent state=stopped
when: inventory_hostname in groups['onos']
- ignore_errors: True
+ ignore_errors: "True"
- name: Stop the Open vSwitch service and clear existing OVSDB
shell: >
@@ -40,7 +40,7 @@
ovs-vsctl del-manager ;
ip link delete onos_port1 type veth peer name onos_port2;
when: groups['onos']|length !=0
- ignore_errors: True
+ ignore_errors: "True"
- name: Install ONOS Cluster on Controller
include: onos_controller.yml
diff --git a/deploy/adapters/ansible/roles/onos_cluster/tasks/onos_controller.yml b/deploy/adapters/ansible/roles/onos_cluster/tasks/onos_controller.yml
index d51151a9..1f7a0e76 100755
--- a/deploy/adapters/ansible/roles/onos_cluster/tasks/onos_controller.yml
+++ b/deploy/adapters/ansible/roles/onos_cluster/tasks/onos_controller.yml
@@ -13,10 +13,14 @@
register: http_server
- name: download onos driver packages
- get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ onos_driver }}" dest=/opt/
+ get_url:
+ url: "http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ onos_driver }}"
+ dest: /opt/
- name: upload onos sfc driver package
- get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ onos_sfc_driver }}" dest=/opt/
+ get_url:
+ url: "http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ onos_sfc_driver }}"
+ dest: /opt/
- name: unarchive onos driver package
command: su -s /bin/sh -c "tar xvf /opt/networking-onos.tar -C /opt/"
@@ -33,24 +37,30 @@
- name: install onos required packages
action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
with_items: packages
-
+
- name: download oracle-jdk8 package file
- get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ jdk8_pkg_name }}" dest=/opt/{{ jdk8_pkg_name }}
+ get_url:
+ url: "http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ jdk8_pkg_name }}"
+ dest: /opt/{{ jdk8_pkg_name }}
- name: download oracle-jdk8 script file
- get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ jdk8_script_name }}" dest=/opt/
+ get_url:
+ url: "http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ jdk8_script_name }}"
+ dest: /opt/
- name: unarchive onos driver package
command: su -s /bin/sh -c "tar xvf /opt/install_jdk8.tar -C /opt/"
-
+
- name: install install_jdk8 package
- command: su -s /bin/sh -c "/opt/install_jdk8/install_jdk8.sh"
-
+ command: su -s /bin/sh -c "/opt/install_jdk8/install_jdk8.sh"
+
- name: create JAVA_HOME environment variable
shell: >
export J2SDKDIR=/usr/lib/jvm/java-8-oracle;
export J2REDIR=/usr/lib/jvm/java-8-oracle/jre;
- export PATH=$PATH:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin;
+ export PATH=$PATH:/usr/lib/jvm/java-8-oracle/bin;
+ export PATH=$PATH:/usr/lib/jvm/java-8-oracle/db/bin;
+ export PATH=$PATH:/usr/lib/jvm/java-8-oracle/jre/bin;
export JAVA_HOME=/usr/lib/jvm/java-8-oracle;
export DERBY_HOME=/usr/lib/jvm/java-8-oracle/db;
@@ -67,20 +77,26 @@
shell: "/bin/false"
- name: download onos package
- get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ onos_pkg_name }}" dest=/opt/{{ onos_pkg_name }}
+ get_url:
+ url: "http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ onos_pkg_name }}"
+ dest: /opt/{{ onos_pkg_name }}
- name: create new jar repository
command: su -s /bin/sh -c "mkdir ~/.m2"
- ignore_errors: True
+ ignore_errors: "True"
- name: download jar repository
- get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ repository }}" dest=~/.m2/
+ get_url:
+ url: "http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ repository }}"
+ dest: ~/.m2/
- name: extract jar repository
command: su -s /bin/sh -c "tar xvf ~/.m2/repository.tar -C ~/.m2/"
- name: extract onos package
- command: su -s /bin/sh -c "tar xzf /opt/{{ onos_pkg_name }} -C {{ onos_home }} --strip-components 1 --no-overwrite-dir -k --skip-old-files" onos
+ command: |
+ su -s /bin/sh -c "tar xzf /opt/{{ onos_pkg_name }} -C {{ onos_home }} \
+ --strip-components 1 --no-overwrite-dir -k --skip-old-files" onos
- name: configure onos service
shell: >
@@ -88,13 +104,15 @@
echo 'export ONOS_USER=root' >> {{ onos_home }}/options;
mkdir {{ onos_home }}/var;
mkdir {{ onos_home }}/config;
- sed -i '/pre-stop/i\env JAVA_HOME=/usr/lib/jvm/java-8-oracle' {{ onos_home }}/init/onos.conf;
+ sed -i '/pre-stop/i\env JAVA_HOME=/usr/lib/jvm/java-8-oracle' \
+ {{ onos_home }}/init/onos.conf;
cp -rf {{ onos_home }}/init/onos.conf /etc/init/;
cp -rf {{ onos_home }}/init/onos.conf /etc/init.d/;
-
+
- name: configure onos boot feature
shell: >
- sed -i '/^featuresBoot=/c\featuresBoot={{ onos_boot_features }}' {{ onos_home }}/{{ karaf_dist }}/etc/org.apache.karaf.features.cfg;
+ sed -i '/^featuresBoot=/c\featuresBoot={{ onos_boot_features }}' \
+ {{ onos_home }}/{{ karaf_dist }}/etc/org.apache.karaf.features.cfg;
- name: wait for config time
shell: "sleep 10"
@@ -109,14 +127,15 @@
shell: >
echo "onos">>/opt/service
-##########################################################################################################
-################################ ONOS connect with OpenStack ################################
-##########################################################################################################
- name: Configure Neutron1
shell: >
- crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins networking_sfc.services.sfc.plugin.SfcPlugin, networking_sfc.services.flowclassifier.plugin.FlowClassifierPlugin, onos_router;
- crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers onos_ml2;
- crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types vxlan;
+ crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins \
+ networking_sfc.services.sfc.plugin.SfcPlugin, \
+ networking_sfc.services.flowclassifier.plugin.FlowClassifierPlugin, onos_router;
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 \
+ mechanism_drivers onos_ml2;
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 \
+ tenant_network_types vxlan;
crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 type_drivers vxlan
- name: Create ML2 Configuration File
@@ -133,8 +152,11 @@
mysql -e "drop database if exists neutron_ml2;";
mysql -e "create database neutron_ml2 character set utf8;";
mysql -e "grant all on neutron_ml2.* to 'neutron'@'%';";
- su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron;
- su -s /bin/sh -c "neutron-db-manage --subproject networking-sfc upgrade head" neutron;
+ su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf \
+ --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" \
+ neutron;
+ su -s /bin/sh -c "neutron-db-manage --subproject networking-sfc \
+ upgrade head" neutron;
- name: Restart neutron-server
service: name=neutron-server state=restarted
diff --git a/deploy/adapters/ansible/roles/onos_cluster/tasks/openvswitch.yml b/deploy/adapters/ansible/roles/onos_cluster/tasks/openvswitch.yml
index aac787ea..4dfa6d45 100755
--- a/deploy/adapters/ansible/roles/onos_cluster/tasks/openvswitch.yml
+++ b/deploy/adapters/ansible/roles/onos_cluster/tasks/openvswitch.yml
@@ -9,49 +9,62 @@
---
- name: set veth port
- shell: >
+ shell: >
ip link add onos_port1 type veth peer name onos_port2;
ifconfig onos_port1 up;
ifconfig onos_port2 up;
- ignore_errors: True
+ ignore_errors: "True"
- name: add openflow-base feature
- command: su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-openflow-base'";
+ command: |
+ su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-openflow-base'";
when: inventory_hostname in groups['onos']
- name: add openflow feature
- command: su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-openflow'";
+ command: |
+ su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-openflow'";
when: inventory_hostname in groups['onos']
- name: add ovsdatabase feature
- command: su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-ovsdatabase'";
+ command: |
+ su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-ovsdatabase'";
when: inventory_hostname in groups['onos']
- name: add ovsdb-base feature
- command: su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-ovsdb-base'";
+ command: |
+ su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-ovsdb-base'";
when: inventory_hostname in groups['onos']
- name: add onos driver ovsdb feature
- command: su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-drivers-ovsdb'";
+ command: |
+ su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-drivers-ovsdb'";
when: inventory_hostname in groups['onos']
- name: add ovsdb provider host feature
- command: su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-ovsdb-provider-host'";
+ command: |
+ su -s /bin/sh -c \
+ "/opt/onos/bin/onos 'feature:install onos-ovsdb-provider-host'";
when: inventory_hostname in groups['onos']
- name: add vtn feature
- command: su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-app-vtn-onosfw'";
+ command: |
+ su -s /bin/sh -c \
+ "/opt/onos/bin/onos 'feature:install onos-app-vtn-onosfw'";
when: inventory_hostname in groups['onos']
- name: set public eth card start
- command: su -s /bin/sh -c "/opt/onos/bin/onos 'externalportname-set -n onos_port2'"
+ command: |
+ su -s /bin/sh -c "/opt/onos/bin/onos 'externalportname-set -n onos_port2'"
when: inventory_hostname in groups['onos']
-- name: Set ONOS as the manager
- command: su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ ip_settings[groups['onos'][0]]['mgmt']['ip'] }}:6640;"
+- name: set ONOS as the manager
+ command: |
+ su -s /bin/sh -c \
+ "ovs-vsctl set-manager \
+ tcp:{{ ip_settings[groups['onos'][0]]['mgmt']['ip'] }}:6640;"
- name: delete default gateway
shell: >
route delete default;
when: inventory_hostname not in groups['onos']
- ignore_errors: True
+ ignore_errors: "True"
diff --git a/deploy/adapters/ansible/roles/onos_cluster/vars/main.yml b/deploy/adapters/ansible/roles/onos_cluster/vars/main.yml
index f11f1102..9389ed6b 100755
--- a/deploy/adapters/ansible/roles/onos_cluster/vars/main.yml
+++ b/deploy/adapters/ansible/roles/onos_cluster/vars/main.yml
@@ -1,3 +1,4 @@
+---
##############################################################################
# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
#
@@ -14,6 +15,25 @@ jdk8_script_name: install_jdk8.tar
onos_driver: networking-onos.tar
onos_sfc_driver: networking-sfc.tar
repository: repository.tar
-onos_boot_features: config,standard,region,package,kar,ssh,management,webconsole,onos-api,onos-core,onos-incubator,onos-cli,onos-rest,onos-gui,onos-openflow-base, onos-openflow, onos-ovsdatabase, onos-ovsdb-base, onos-drivers-ovsdb, onos-ovsdb-provider-host, onos-app-vtn-onosfw
-
-
+onos_boot_features:
+ - config
+ - standard
+ - region
+ - package
+ - kar
+ - ssh
+ - management
+ - webconsole
+ - onos-api
+ - onos-core
+ - onos-incubator
+ - onos-cli
+ - onos-rest
+ - onos-gui
+ - onos-openflow-base
+ - onos-openflow
+ - onos-ovsdatabase
+ - onos-ovsdb-base
+ - onos-drivers-ovsdb
+ - onos-ovsdb-provider-host
+ - onos-app-vtn-onosfw