aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/onos_cluster/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'deploy/adapters/ansible/roles/onos_cluster/tasks')
-rwxr-xr-xdeploy/adapters/ansible/roles/onos_cluster/tasks/main.yml125
-rwxr-xr-xdeploy/adapters/ansible/roles/onos_cluster/tasks/onos_controller.yml175
-rwxr-xr-xdeploy/adapters/ansible/roles/onos_cluster/tasks/onos_sfc_controller.yml160
-rwxr-xr-xdeploy/adapters/ansible/roles/onos_cluster/tasks/openvswitch.yml77
4 files changed, 0 insertions, 537 deletions
diff --git a/deploy/adapters/ansible/roles/onos_cluster/tasks/main.yml b/deploy/adapters/ansible/roles/onos_cluster/tasks/main.yml
deleted file mode 100755
index b86b149e..00000000
--- a/deploy/adapters/ansible/roles/onos_cluster/tasks/main.yml
+++ /dev/null
@@ -1,125 +0,0 @@
-##############################################################################
-# Copyright (c) 2016 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
-##############################################################################
----
-- include_vars: "{{ ansible_os_family }}.yml"
-
-- name: install onos related packages
- action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
- with_items: "{{ packages | union(packages_noarch) }}"
- when: groups['onos']|length !=0
-
-- name: remove neutron-openvswitch-agent auto start
- shell: >
- update-rc.d neutron-openvswitch-agent remove;
- sed -i /neutron-openvswitch-agent/d /opt/service
- when: groups['onos']|length !=0
- ignore_errors: "True"
-
-- name: shut down and disable Neutron's agent services
- service: name=neutron-openvswitch-agent state=stopped
- when: groups['onos']|length !=0
- 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"
-
-- 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"
-
-- name: Stop the Open vSwitch service and clear existing OVSDB
- shell: >
- service openvswitch-switch stop ;
- rm -rf /var/log/openvswitch/* ;
- rm -rf /etc/openvswitch/conf.db ;
- service openvswitch-switch start ;
- when: groups['onos']|length !=0
- ignore_errors: "True"
-
-##################################################################
-########### Recover External network #################
-##################################################################
-
-- name: add ovs bridge
- openvswitch_bridge: bridge={{ item["name"] }} state=present
- with_items: "{{ network_cfg['provider_net_mappings'] }}"
- when: item["type"] == "ovs" and groups['onos']|length !=0
-
-- name: add ovs uplink
- openvswitch_port: bridge={{ item["name"] }} port={{ item["interface"] }} state=present
- with_items: "{{ network_cfg['provider_net_mappings'] }}"
- when: item["type"] == "ovs" and groups['onos']|length !=0
-
-- name: add ovs uplink
- shell: ip link set {{ item["interface"] }} up
- with_items: "{{ network_cfg['provider_net_mappings'] }}"
- when: item["type"] == "ovs" and groups['onos']|length !=0
-
-- name: ensure script dir exist
- shell: mkdir -p /opt/setup_networks
- when: groups['onos']|length !=0
-
-- name: copy scripts
- copy: src={{ item }} dest=/opt/setup_networks
- with_items:
- - setup_networks/log.py
- - setup_networks/setup_networks.py
- when: groups['onos']|length !=0
-
-- name: copy boot scripts
- copy: src={{ item }} dest=/etc/init.d/ mode=0755
- with_items:
- - setup_networks/net_init
- when: groups['onos']|length !=0
-
-- name: copy config files
- template: src=network.cfg dest=/opt/setup_networks
- when: groups['onos']|length !=0
-
-- name: make sure python lib exist
- action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
- with_items:
- - python-yaml
- - python-netaddr
- when: groups['onos']|length !=0
-
-- name: run scripts
- shell: python /opt/setup_networks/setup_networks.py
- when: groups['onos']|length !=0
-
-- name: add to boot scripts
- service: name=net_init enabled=yes
- when: groups['onos']|length !=0
-##################################################################
-
-- name: restart keepalived to recover external IP
- shell: service keepalived restart
- when: inventory_hostname in groups['onos']
- ignore_errors: "True"
-
-- name: upgrade pbr
- shell: |
- pip install pbr --upgrade
-
-- name: Install ONOS Cluster on Controller
- include: onos_controller.yml
- when: inventory_hostname in groups['onos'] and onos_sfc == "Disable"
-
-- name: Install ONOS Cluster on Controller
- include: onos_sfc_controller.yml
- when: inventory_hostname in groups['onos'] and onos_sfc == "Enable"
-
-- name: Config ONOS Cluster
- include: openvswitch.yml
- when: groups['onos']|length !=0
diff --git a/deploy/adapters/ansible/roles/onos_cluster/tasks/onos_controller.yml b/deploy/adapters/ansible/roles/onos_cluster/tasks/onos_controller.yml
deleted file mode 100755
index 87396bf0..00000000
--- a/deploy/adapters/ansible/roles/onos_cluster/tasks/onos_controller.yml
+++ /dev/null
@@ -1,175 +0,0 @@
-##############################################################################
-# Copyright (c) 2016 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
-##############################################################################
----
-
-- name: get image http server
- shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf
- register: http_server
-
-- name: download onos driver packages
- get_url:
- url: "http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ onos_driver }}"
- dest: /opt/
-
-- name: unarchive onos driver package
- command: su -s /bin/sh -c "tar xvf /opt/networking-onos.tar -C /opt/"
-
-- name: install onos driver
- command: su -s /bin/sh -c "/opt/networking-onos/install_driver.sh"
-
-- name: download oracle-jdk8 package file
- get_url:
- url: "http://{{ http_server.stdout_lines[0] }}/packages/java/{{ jdk8_pkg_name }}"
- dest: /opt/{{ jdk8_pkg_name }}
-
-- name: install onos required packages
- action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
- with_items: "{{ packages }}"
-
-- name: download oracle-jdk8 script file
- get_url:
- url: "http://{{ http_server.stdout_lines[0] }}/packages/java/{{ 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"
-
-- 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;
- 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;
-
-- name: create onos group
- group: name=onos system=yes state=present
-
-- name: create onos user
- user:
- name: onos
- group: onos
- home: "{{ onos_home }}"
- createhome: "yes"
- system: "yes"
- 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 }}
-
-- name: create new jar repository
- command: su -s /bin/sh -c "mkdir ~/.m2"
- ignore_errors: "True"
-
-- name: download jar repository
- 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
-
-- name: copy onos.service
- copy:
- src: "{{ onos_service_file.src }}"
- dest: "{{ onos_service_file.dst }}"
- mode: 0755
-
-- name: configure onos service
- shell: >
- echo 'export ONOS_OPTS=debug' > {{ onos_home }}/options;
- echo 'export ONOS_USER=root' >> {{ onos_home }}/options;
- mkdir {{ onos_home }}/var;
- mkdir {{ onos_home }}/config;
-
-- name: create karaf config
- template:
- src: org.apache.karaf.features.cfg
- dest: "{{ onos_home }}/{{ karaf_dist }}/etc/org.apache.karaf.features.cfg"
- owner: onos
- group: onos
- mode: 0775
-
-- name: wait for config time
- shell: "sleep 10"
-
-- name: chown onos directory and files
- shell: >
- chown -R onos:onos "{{ onos_home }}";
- chown onos:onos "{{ onos_service_file.dst }}";
-
-- name: start onos service
- service: name=onos state=started enabled=yes
-
-- name: wait for onos start time
- shell: "sleep 200"
-
-- name: add onos auto start
- shell: >
- echo "onos">>/opt/service
-
-- name: Configure Neutron1
- shell: >
- crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins 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: configure metadata
- shell: |
- crudini --set /etc/neutron/dhcp_agent.ini DEFAULT \
- enable_isolated_metadata "True";
-
-- name: force metadata
- shell: |
- crudini --set /etc/neutron/dhcp_agent.ini DEFAULT \
- force_metadata "True";
-
-- name: configure vsctl for dhcp agent
- shell: |
- crudini --set /etc/neutron/dhcp_agent.ini OVS \
- ovsdb_interface vsctl;
-
-- name: Create ML2 Configuration File
- template:
- src: ml2_conf.sh
- dest: "/opt/ml2_conf.sh"
- mode: 0777
-
-- name: Configure Neutron2
- command: su -s /bin/sh -c "/opt/ml2_conf.sh;"
-
-- name: Configure Neutron3
- shell: >
- 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;
-
-- name: Restart neutron-dhcp-agent
- service: name=neutron-dhcp-agent state=restarted
-
-- name: Restart neutron-server
- service: name=neutron-server state=restarted
diff --git a/deploy/adapters/ansible/roles/onos_cluster/tasks/onos_sfc_controller.yml b/deploy/adapters/ansible/roles/onos_cluster/tasks/onos_sfc_controller.yml
deleted file mode 100755
index 26679373..00000000
--- a/deploy/adapters/ansible/roles/onos_cluster/tasks/onos_sfc_controller.yml
+++ /dev/null
@@ -1,160 +0,0 @@
-##############################################################################
-# Copyright (c) 2016 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
-##############################################################################
----
-
-- name: get image http server
- shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf
- register: http_server
-
-- name: download onos driver packages
- get_url:
- url: "http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ onos_driver }}"
- dest: /opt/
-
-- name: download onos sfc driver package
- 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/"
-
-- name: unarchive onos sfc driver package
- command: su -s /bin/sh -c "tar xvf /opt/networking-sfc.tar -C /opt/"
-
-- name: install onos driver
- command: su -s /bin/sh -c "/opt/networking-onos/install_driver.sh"
-
-- name: install onos sfc driver
- command: su -s /bin/sh -c "/opt/networking-sfc/install_driver.sh"
-
-- 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/java/{{ jdk8_pkg_name }}"
- dest: /opt/{{ jdk8_pkg_name }}
-
-- name: download oracle-jdk8 script file
- get_url:
- url: "http://{{ http_server.stdout_lines[0] }}/packages/java/{{ 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"
-
-- 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;
- 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;
-
-- name: create onos group
- group: name=onos system=yes state=present
-
-- name: create onos user
- user:
- name: onos
- group: onos
- home: "{{ onos_home }}"
- createhome: "yes"
- system: "yes"
- 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 }}
-
-- name: create new jar repository
- command: su -s /bin/sh -c "mkdir ~/.m2"
- ignore_errors: "True"
-
-- name: download jar repository
- 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
-
-- name: configure onos service
- shell: >
- echo 'export ONOS_OPTS=debug' > {{ onos_home }}/options;
- 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;
- 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;
-
-- name: wait for config time
- shell: "sleep 10"
-
-- name: start onos service
- service: name=onos state=started enabled=yes
-
-- name: wait for onos start time
- shell: "sleep 200"
-
-- name: add onos auto start
- 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/plugins/ml2/ml2_conf.ini ml2 type_drivers vxlan
-
-- name: Create ML2 Configuration File
- template:
- src: ml2_conf.sh
- dest: "/opt/ml2_conf.sh"
- mode: 0777
-
-- name: Configure Neutron2
- command: su -s /bin/sh -c "/opt/ml2_conf.sh;"
-
-- name: Configure Neutron3
- shell: >
- 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;
-
-- 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
deleted file mode 100755
index 7541d108..00000000
--- a/deploy/adapters/ansible/roles/onos_cluster/tasks/openvswitch.yml
+++ /dev/null
@@ -1,77 +0,0 @@
-###############################################################################
-# Copyright (c) 2016 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
-###############################################################################
----
-
-- name: set veth port
- shell: >
- ip link add onos_port1 type veth peer name onos_port2;
- ifconfig onos_port1 up;
- ifconfig onos_port2 up;
- ignore_errors: "True"
-
-- name: set veth to ovs
- shell: >
- export externamMac=`ifconfig eth1 | grep -Eo '\<[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'`;
- ifconfig onos_port2 hw ether $externamMac;
- ovs-vsctl add-port br-prv onos_port1;
- ignore_errors: "True"
-
-- name: add onos optical model feature
- command: |
- su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-optical-model'";
- when: inventory_hostname in groups['onos']
-
-- name: add openflow-base feature
- command: |
- su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-providers-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-providers-openflow-message'";
- when: inventory_hostname in groups['onos']
-
-- name: add ovsdb-base feature
- command: |
- su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-providers-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'";
- 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-providers-ovsdb-host'";
- when: inventory_hostname in groups['onos']
-
-- name: add vtn feature
- command: |
- su -s /bin/sh -c \
- "/opt/onos/bin/onos 'feature:install onos-apps-vtn'";
- 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'"
- 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: delete default gateway
- shell: >
- route delete default;
- when: inventory_hostname not in groups['onos']
- ignore_errors: "True"