aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/odl_cluster
diff options
context:
space:
mode:
authorchenshuai@huawei.com <chenshuai@huawei.com>2015-12-25 09:00:33 +0800
committershuai chen <chenshuai@huawei.com>2015-12-25 08:54:50 +0000
commit4e9fd679144032ead4a5adb77f2f3a1d84de46b2 (patch)
tree1f7504c6e37e3fdcd9b3aaac131b063cf8c09f71 /deploy/adapters/ansible/roles/odl_cluster
parentbb31ed2d10f1876a50353abb258c2a5be13e2da2 (diff)
bugfix: change recreating neutron_ml2 db to recreating neutron db
JIRA: COMPASS-215 Change-Id: I29421e582df2472cbd6263283f46753b7f0296c2 Signed-off-by: chenshuai@huawei.com <chenshuai@huawei.com>
Diffstat (limited to 'deploy/adapters/ansible/roles/odl_cluster')
-rwxr-xr-xdeploy/adapters/ansible/roles/odl_cluster/tasks/main.yml8
-rwxr-xr-xdeploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml79
-rwxr-xr-xdeploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml35
-rwxr-xr-xdeploy/adapters/ansible/roles/odl_cluster/templates/org.apache.karaf.features.cfg7
4 files changed, 77 insertions, 52 deletions
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml
index 738da5b2..1eb517b8 100755
--- a/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml
@@ -9,12 +9,4 @@
include: openvswitch.yml
when: groups['odl']|length !=0 and inventory_hostname not in groups['odl']
-- meta: flush_handlers
-- name: check out new flow table if enable
- shell: ovs-ofctl --protocol=OpenFlow13 dump-flows br-int | grep CONTROLLER; while [ $? -ne 0 ]; do sleep 10; ovs-ofctl --protocol=OpenFlow13 dump-flows br-int | grep CONTROLLER; done
- when: groups['odl']|length !=0
-
-#- name: remove controller from br-prv
-# shell: ovs-vsctl del-controller br-prv;
-# when: groups['odl']|length !=0
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml
index 2cd4e23a..24b69326 100755
--- a/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml
@@ -57,8 +57,8 @@
- name: extract odl package
# unarchive: src=/opt/{{ odl_pkg_name }} dest={{ odl_home }} group=odl owner=odl mode=0775 copy=no
command: su -s /bin/sh -c "tar xzf /opt/{{ odl_pkg_name }} -C {{ odl_home }} --strip-components 1 --no-overwrite-dir -k --skip-old-files" odl
- notify:
- - restart odl service
+# notify:
+# - restart odl service
- name: opendaylight system file
template:
@@ -73,15 +73,15 @@
owner: odl
group: odl
mode: 0775
- notify:
- - restart odl service
+# notify:
+# - restart odl service
- name: create tomcat config
template:
src: tomcat-server.xml
dest: "{{ odl_home }}/configuration/tomcat-server.xml"
- notify:
- - restart odl service
+# notify:
+# - restart odl service
- name: install odl pip packages
@@ -103,16 +103,16 @@
template:
src: akka.conf
dest: "{{ odl_home }}/configuration/initial/akka.conf"
- notify:
- - restart odl service
+# notify:
+# - restart odl service
- name: create module-shards config
template:
src: module-shards.conf
dest: "{{ odl_home }}/configuration/initial/module-shards.conf"
- notify:
- - restart odl service
+# notify:
+# - restart odl service
#- name: copy Jolokia-OSGi config
# shell: >
@@ -146,9 +146,8 @@
#- name: copy Jolokia-OSGi jar config
# copy: src=roles/odl_cluster/templates/jolokia-osgi-1.1.5.jar dest="{{ odl_home }}/system/org/jolokia/jolokia-osgi/1.1.5/"
-- name: remove KARAF Data Directory
- shell: >
- rm -rf {{ odl_home }}/data/*;
+- name: remove karaf data directory
+ shell: rm -rf {{ odl_home }}/data/*;
#- name: chown OpenDaylight Directory and Files
# shell: >
@@ -159,26 +158,39 @@
##########################################################################################################
################################ OpenDayLight connect with OpenStack ################################
##########################################################################################################
-- name: Turn off neutron-server Daemon on control node
- shell: sed -i '/neutron-plugin-openvswitch-agent/d' /opt/service ;
-
-- name: Turn off neutron-server on control node
+- name: turn off neutron-server neutron-plugins-openvswitch-agent Daemon on control node
+ shell: >
+ sed -i '/neutron-plugin-openvswitch-agent/d' /opt/service ;
+ sed -i '/neutron-server/d' /opt/service;
+ sed -i '/keepalived/d' /opt/service;
+
+- name: turn off neutron-server on control node
service: name=neutron-server state=stopped
+- name: turn off keepalived on control node
+ service: name=keepalived state=stopped
+
#- name: Install Crudini
# apt: name={{ item }} state=present
# with_items:
# - crudini
-- name: Run OpenVSwitch Script
- include: openvswitch.yml
-
-- name: chown OpenDaylight Directory and Files
+- name: chown opendaylight directory and files
shell: >
chown -R odl:odl "{{ odl_home }}";
chown odl:odl "{{ service_file.dst }}";
+- name: start opendaylight
+ service: name=opendaylight state=started
+
+- name: check if opendaylight running
+ shell: netstat -lpen --tcp | grep java | grep 6653; while [ $? -ne 0 ]; do sleep 10; netstat -lpen --tcp | grep java | grep 6653; done
+
+- name: run openvswitch script
+ include: openvswitch.yml
+
+
#- name: Configure Neutron1
# shell: >
# crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight;
@@ -193,17 +205,26 @@
#- name: Execute ML2 Configuration File
# command: su -s /bin/sh -c "/opt/ml2_conf.sh;"
-- name: Configure Neutron2
- 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: drop and recreate neutron database
+ shell: mysql -e "drop database if exists neutron;";
+ mysql -e "create database neutron character set utf8;";
+ mysql -e "grant all on neutron.* to 'neutron'@'%' identified by 'console';";
+ 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;
+ when: inventory_hostname == haproxy_hosts.keys()[0]
-- name: Restart neutron-server
+- name: restart neutron-server
service: name=neutron-server state=started
-- name: Add service daemon
+- name: add service daemon
shell: >
echo opendaylight >> /opt/service ;
echo neutron-server >> /opt/service ;
+
+- name: restart neutron-l3-agent server
+ service: name=neutron-l3-agent state=restarted
+
+- name: restart neutron-dhcp-agent server
+ service: name=neutron-dhcp-agent state=restarted
+
+- name: restart neutron-metadata-agent server
+ service: name=neutron-metadata-agent state=restarted
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml
index 6f063c76..34151317 100755
--- a/deploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml
@@ -9,9 +9,8 @@
action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
with_items: compute_packages | union(compute_packages_noarch)
-- name: Adjust Service Daemon
- shell: >
- sed -i '/neutron-plugin-openvswitch-agent/d' /opt/service ;
+- name: remove neutron-openvswitch-agent service daemon
+ shell: sed -i '/neutron-plugin-openvswitch-agent/d' /opt/service ;
- name: shut down and disable Neutron's openvswitch agent services
service: name=neutron-plugin-openvswitch-agent state=stopped
@@ -41,12 +40,18 @@
rm -rf /etc/openvswitch/conf.db ;
service openvswitch-switch start ;
-- name: Set OpenDaylight as the manager
- command: su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ internal_vip.ip }}:6640;"
+#- name: Set OpenDaylight as the manager
+# command: su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ internal_vip.ip }}:6640;"
+
+
+- name: recover br-int
+ shell: ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) other_config={'local_ip'=' {{ internal_ip }} '};
+#'
##################################################################
################ Recover External network #######################
##################################################################
+
- name: add ovs bridge
openvswitch_bridge: bridge={{ item["name"] }} state=present
with_items: "{{ network_cfg['provider_net_mappings'] }}"
@@ -63,39 +68,41 @@
- recover_network.py
when: extbr.rc == 0
-- name: Recover external script
+- name: recover external script
shell: python /opt/setup_networks/recover_network.py
when: extbr.rc == 0
-- name: start and disable Neutron's agent services
+- name: restart keepalived
shell: service keepalived restart
when: inventory_hostname in groups['odl'] and extbr.rc == 0
+ ignore_errors: True
##################################################################
##################################################################
##################################################################
+- name: set opendaylight as the manager
+ command: su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ internal_vip.ip }}:6640;"
+- name: check br-int
+ shell: ovs-vsctl list-br | grep br-int; while [ $? -ne 0 ]; do sleep 10; ovs-vsctl list-br | grep br-int; done
-
-#- name: start and disable Neutron's agent services
-# service: name=neutron-plugin-openvswitch-agent state=started
-
-- name: Configure Neutron1
+- name: configure opendaylight -> ml2
shell: >
crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight;
crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types vxlan;
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs enable_tunneling True;
#- name: Adjust Service Daemon
# shell: >
# sed -i '/neutron-plugin-openvswitch-agent/d' /opt/service ;
# echo opendaylight >> /opt/service ;
-- name: Create ML2 Configuration File
+- name: copy ml2 configuration script
template:
src: ml2_conf.sh
dest: "/opt/ml2_conf.sh"
mode: 0777
-- name: Execute ML2 Configuration File
+- name: execute ml2 configuration script
command: su -s /bin/sh -c "/opt/ml2_conf.sh;"
diff --git a/deploy/adapters/ansible/roles/odl_cluster/templates/org.apache.karaf.features.cfg b/deploy/adapters/ansible/roles/odl_cluster/templates/org.apache.karaf.features.cfg
index 05c66ffd..e9953e7f 100755
--- a/deploy/adapters/ansible/roles/odl_cluster/templates/org.apache.karaf.features.cfg
+++ b/deploy/adapters/ansible/roles/odl_cluster/templates/org.apache.karaf.features.cfg
@@ -41,7 +41,12 @@ featuresRepositories = mvn:org.apache.karaf.features/standard/3.0.3/xml/features
#
# Comma separated list of features to install at startup
#
-featuresBoot=config,standard,region,package,kar,ssh,management,odl-base-all,odl-restconf,odl-ovsdb-openstack,odl-dlux-all,odl-mdsal-apidocs,odl-mdsal-clustering,odl-openflowplugin-flow-services
+featuresBoot=config,standard,region,package,kar,ssh,management,odl-ovsdb-openstack
+
+#,odl-restconf-all,odl-aaa-authn,odl-dlux-all
+
+# odl-base-all,odl-restconf,odl-ovsdb-openstack,odl-dlux-all,odl-mdsal-apidocs
+#,odl-mdsal-clustering,odl-openflowplugin-flow-services
#
# Defines if the boot features are started in asynchronous mode (in a dedicated thread)