diff options
author | chenshuai@huawei.com <chenshuai@huawei.com> | 2015-08-30 21:47:49 -0400 |
---|---|---|
committer | chenshuai@huawei.com <chenshuai@huawei.com> | 2015-09-02 02:26:24 -0400 |
commit | 633175ed2c5d0ab339027ba0a542bcdd4d3769c0 (patch) | |
tree | e9dad6f2819b113ac7f0a9695254e05b5fc1fc94 /deploy/adapters | |
parent | 60d16e487ba8641640a185369f3882e1227e56d7 (diff) |
Write ODL ansible script for Ubuntu14.04
JIRA: COMPASS-23
Change-Id: Iad692c8f77492989e29d0a4862989edea1d48fc5
Signed-off-by: chenshuai@huawei.com <chenshuai@huawei.com>
Diffstat (limited to 'deploy/adapters')
17 files changed, 140 insertions, 88 deletions
diff --git a/deploy/adapters/ansible/openstack_juno/HA-ansible-multinodes.yml b/deploy/adapters/ansible/openstack_juno/HA-ansible-multinodes.yml index c330172d..f8f8b442 100644 --- a/deploy/adapters/ansible/openstack_juno/HA-ansible-multinodes.yml +++ b/deploy/adapters/ansible/openstack_juno/HA-ansible-multinodes.yml @@ -34,7 +34,7 @@ - neutron-compute - cinder-volume -- hosts: odl +- hosts: all remote_user: root sudo: True roles: diff --git a/deploy/adapters/ansible/roles/odl_cluster/handlers/main.yml b/deploy/adapters/ansible/roles/odl_cluster/handlers/main.yml index 017700b7..81e6c658 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/handlers/main.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/handlers/main.yml @@ -1,4 +1,4 @@ --- - name: restart odl service - #service: name=opendaylight state=restarted - command: su -s /bin/sh -c "{{ odl_home }}/bin/stop;{{ odl_home }}/bin/start;" + service: name=opendaylight state=restarted + #command: su -s /bin/sh -c "{{ odl_home }}/bin/stop;{{ odl_home }}/bin/start;" diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml index 1b27ed14..5c6805c0 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml @@ -7,4 +7,4 @@ - name: Install ODL Cluster on Compute include: main_compute.yml - when: inventory_hostname in groups['compute'] + when: groups['odl']|length !=0 and inventory_hostname not in groups['odl'] diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/main_compute.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/main_compute.yml deleted file mode 100644 index 39947661..00000000 --- a/deploy/adapters/ansible/roles/odl_cluster/tasks/main_compute.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -- name: shut down and disable Neutron's agent services - service: name=neutron-plugin-openvswitch-agent state=stopped - -- 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 ; - -- name: Set OpenDaylight as the manager - command: su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{odl_controller}}:6640;" - -- name: start and disable Neutron's agent services - service: name=neutron-plugin-openvswitch-agent state=started diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/main_controller.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml index 751af715..ea90b84e 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/tasks/main_controller.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml @@ -1,5 +1,5 @@ --- -- name: install jdk packages +- name: install java packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" with_items: packages | union(packages_noarch) @@ -28,8 +28,15 @@ system: "yes" shell: "/bin/false" +- name: get image http server + shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf + register: http_server + - name: download odl package - get_url: url={{ odl_pkg_url }} dest=/opt/{{ odl_pkg_name }} + get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/odl/{{ odl_pkg_url }}" dest=/opt/{{ odl_pkg_name }} + +#- name: download odl package +# get_url: url={{ odl_pkg_url }} dest=/opt/{{ odl_pkg_name }} # TODO: unarchive doesn't support strip-component at the moment # TODO: switch to use untar after support is added. @@ -39,18 +46,21 @@ notify: - restart odl service -#- name: opendaylight systemd file -# template: src=opendaylight.service dest=/usr/lib/systemd/system/opendaylight.service mode=0644 - -- name: create karaf config +- name: opendaylight system file template: - src: org.apache.karaf.features.cfg - dest: "{{ odl_home }}/etc/org.apache.karaf.features.cfg" - owner: odl - group: odl - mode: 0775 - notify: - - restart odl service + src: "{{ service_file.src }}" + dest: "{{ service_file.dst }}" + mode: 0644 + +#- name: create karaf config +# template: +# src: org.apache.karaf.features.cfg +# dest: "{{ odl_home }}/etc/org.apache.karaf.features.cfg" +# owner: odl +# group: odl +# mode: 0775 +# notify: +# - restart odl service - name: create tomcat config template: @@ -84,14 +94,47 @@ notify: - restart odl service -- name: copy Jolokia-OSGi config - shell: > - cp -r jolokia {{ odl_home }}/system/org/; +#- name: copy Jolokia-OSGi config +# shell: > +# cp -r jolokia {{ odl_home }}system/org/; + +#- name: copy Jolokia-OSGi config +# template: +# src: jolokia +# dest: "{{ odl_home }}/system/org/" +# notify: +# - restart odl service + + +#- name: mkdir Jolokia-OSGi directory +# shell: > +# mkdir -p {{ odl_home }}system/org/jolokia; +# mkdir -p {{ odl_home }}system/org/jolokia/jolokia-osgi; +# mkdir -p {{ odl_home }}system/org/jolokia/jolokia-osgi/1.1.5; + + +#- name: copy Jolokia-OSGi config +# template: src={{ item.src }} dest={{ item.dest }} +# with_items: +# - src: "jolokia-osgi-1.1.5-features.xml" +# dest: "{{ odl_home }}/system/org/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5-features.xml" +# - src: "jolokia-osgi-1.1.5.jar.sha1" +# dest: "{{ odl_home }}/system/org/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5.jar.sha1" +# - src: "jolokia-osgi-1.1.5.jar" +# dest: "{{ odl_home }}/system/org/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5.jar" + +#- 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: chown OpenDaylight Directory and Files + shell: > + chown -R odl:odl "{{ odl_home }}"; + chown odl:odl "{{ service_file.dst }}"; + ########################################################################################################## ################################ OpenDayLight connect with OpenStack ################################ @@ -99,42 +142,29 @@ - name: Turn off neutron-server on control node service: name=neutron-server state=stopped -- name: shut down and disable Neutron's agent services - service: name=neutron-plugin-openvswitch-agent state=stopped - -- 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 ; - -- name: Set OpenDaylight as the manager - command: su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{odl_controller}}:6640;" - -- name: start and disable Neutron's agent services - service: name=neutron-plugin-openvswitch-agent state=started - - name: Install Crudini apt: name={{ item }} state=present with_items: - crudini -- name: Configure Neutron1 - 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; +- name: Run OpenVSwitch Script + include: openvswitch.yml -- name: Create ML2 Configuration File - template: - src: ml2_conf.sh - dest: "/opt/ml2_conf.sh" - mode: 0777 +#- name: Configure Neutron1 +# 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; -- name: Configure Neutron2 - command: su -s /bin/sh -c "/opt/ml2_conf.sh;" +#- name: Create ML2 Configuration File +# template: +# src: ml2_conf.sh +# dest: "/opt/ml2_conf.sh" +# mode: 0777 + +#- name: Execute ML2 Configuration File +# command: su -s /bin/sh -c "/opt/ml2_conf.sh;" -- name: Configure Neutron3 +- name: Configure Neutron2 shell: > mysql -e "drop database if exists neutron_ml2;"; mysql -e "create database neutron_ml2 character set utf8;"; @@ -143,7 +173,3 @@ - name: Restart neutron-server service: name=neutron-server state=started - - - - diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml new file mode 100644 index 00000000..e59ca37e --- /dev/null +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml @@ -0,0 +1,40 @@ +--- + +- name: Install Crudini + apt: name={{ item }} state=present + with_items: + - crudini + +- name: shut down and disable Neutron's openvswitch agent services + service: name=neutron-plugin-openvswitch-agent state=stopped + +- name: remove Neutron's openvswitch agent services + shell: > + update-rc.d neutron-plugin-openvswitch-agent remove + +#- 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 ; + +- name: Set OpenDaylight as the manager + command: su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ HA_VIP }}:6640;" + +- name: start and disable Neutron's agent services + service: name=neutron-plugin-openvswitch-agent state=started + +- name: Configure Neutron1 + 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 vlan; + +- name: Create ML2 Configuration File + template: + src: ml2_conf.sh + dest: "/opt/ml2_conf.sh" + mode: 0777 + +- name: Execute ML2 Configuration File + command: su -s /bin/sh -c "/opt/ml2_conf.sh;" diff --git a/deploy/adapters/ansible/roles/odl_cluster/templates/akka.conf b/deploy/adapters/ansible/roles/odl_cluster/templates/akka.conf index 4818e340..318a8729 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/templates/akka.conf +++ b/deploy/adapters/ansible/roles/odl_cluster/templates/akka.conf @@ -38,7 +38,7 @@ odl-cluster-data { cluster { seed-nodes = [ -{% for host in groups['odl_controller'] %} +{% for host in groups['odl'] %} {% if loop.last %} "akka.tcp://opendaylight-cluster-data@{{ hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:2550" {% else %} @@ -51,7 +51,7 @@ odl-cluster-data { roles = [ {% set key = 0 %} -{% for host in groups['odl_controller'] %} +{% for host in groups['odl'] %} {% set key = key + 1 %} {% if hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address == hostvars[inventory_hostname]['ansible_' + INTERNAL_INTERFACE].ipv4.address %} "member-{{ key }}" @@ -90,7 +90,7 @@ odl-cluster-rpc { cluster { seed-nodes = [ -{% for host in groups['odl_controller'] %} +{% for host in groups['odl'] %} {% if loop.last %} "akka.tcp://odl-cluster-rpc@{{ hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:2551" {% else %} diff --git a/deploy/adapters/ansible/roles/odl_cluster/templates/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5-features.xml b/deploy/adapters/ansible/roles/odl_cluster/templates/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5-features.xml deleted file mode 100644 index 6242d788..00000000 --- a/deploy/adapters/ansible/roles/odl_cluster/templates/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5-features.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="framework-3.0.1"> - <repository>mvn:org.jolokia/jolokia-osgi/1.1.5/xml/features</repository> - <feature name="jolokia-osgi" version="1.1.5" description="Jolokia Agent"> - <bundle start-level="5" start="true">mvn:org.jolokia/jolokia-osgi/1.1.5</bundle> - </feature> -</features> - diff --git a/deploy/adapters/ansible/roles/odl_cluster/templates/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5.jar b/deploy/adapters/ansible/roles/odl_cluster/templates/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5.jar Binary files differdeleted file mode 100644 index 18e8710b..00000000 --- a/deploy/adapters/ansible/roles/odl_cluster/templates/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5.jar +++ /dev/null diff --git a/deploy/adapters/ansible/roles/odl_cluster/templates/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5.jar.sha1 b/deploy/adapters/ansible/roles/odl_cluster/templates/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5.jar.sha1 deleted file mode 100644 index 790e6ef2..00000000 --- a/deploy/adapters/ansible/roles/odl_cluster/templates/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -ba513164178626519a6fb12ced4a3d6e1e07dd54
\ No newline at end of file diff --git a/deploy/adapters/ansible/roles/odl_cluster/templates/ml2_conf.sh b/deploy/adapters/ansible/roles/odl_cluster/templates/ml2_conf.sh index 1ce1e41e..7f61d367 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/templates/ml2_conf.sh +++ b/deploy/adapters/ansible/roles/odl_cluster/templates/ml2_conf.sh @@ -2,5 +2,5 @@ cat <<EOT>> /etc/neutron/plugins/ml2/ml2_conf.ini [ml2_odl] password = admin username = admin -url = http://{{ hostvars[inventory_hostname]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:8080/controller/nb/v2/neutron +url = http://{{ HA_VIP }}:8080/controller/nb/v2/neutron EOT diff --git a/deploy/adapters/ansible/roles/odl_cluster/templates/module-shards.conf b/deploy/adapters/ansible/roles/odl_cluster/templates/module-shards.conf index 4477b392..9a5d4c38 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/templates/module-shards.conf +++ b/deploy/adapters/ansible/roles/odl_cluster/templates/module-shards.conf @@ -29,7 +29,7 @@ module-shards = [ name="default" replicas = [ {% set key = 0 %} -{% for host in groups['controller'] %} +{% for host in groups['odl'] %} {% set key = key + 1 %} {% if loop.last %} "member-{{ key }}" @@ -48,7 +48,7 @@ module-shards = [ name="topology" replicas = [ {% set key = 0 %} -{% for host in groups['controller'] %} +{% for host in groups['odl'] %} {% set key = key + 1 %} {% if loop.last %} "member-{{ key }}" @@ -67,7 +67,7 @@ module-shards = [ name="inventory" replicas = [ {% set key = 0 %} -{% for host in groups['controller'] %} +{% for host in groups['odl'] %} {% set key = key + 1 %} {% if loop.last %} "member-{{ key }}" @@ -86,7 +86,7 @@ module-shards = [ name="toaster" replicas = [ {% set key = 0 %} -{% for host in groups['controller'] %} +{% for host in groups['odl'] %} {% set key = key + 1 %} {% if loop.last %} "member-{{ key }}" diff --git a/deploy/adapters/ansible/roles/odl_cluster/templates/opendaylight.service b/deploy/adapters/ansible/roles/odl_cluster/templates/opendaylight.service index 61a1dbdc..a4adeeec 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/templates/opendaylight.service +++ b/deploy/adapters/ansible/roles/odl_cluster/templates/opendaylight.service @@ -5,7 +5,7 @@ After=network.service [Service] Type=forking -ExecStart=/opt/opendaylight-0.2.2/bin/start +ExecStart=/opt/opendaylight-0.3.0/bin/start User=odl Group=odl 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 e53a07b2..4f439c25 100644 --- 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 @@ -38,7 +38,7 @@ # #featuresRepositories = mvn:org.apache.karaf.features/standard/3.0.1/xml/features,mvn:org.apache.karaf.features/enterprise/3.0.1/xml/features,mvn:org.ops4j.pax.web/pax-web-features/3.1.0/xml/features,mvn:org.apache.karaf.features/spring/3.0.1/xml/features,mvn:org.opendaylight.integration/features-integration/0.2.2-Helium-SR2/xml/features,mvn:org.jolokia/jolokia-osgi/1.1.4/xml/features -featuresRepositories = mvn:org.apache.karaf.features/standard/3.0.1/xml/features,mvn:org.apache.karaf.features/enterprise/3.0.1/xml/features,mvn:org.ops4j.pax.web/pax-web-features/3.1.0/xml/features,mvn:org.apache.karaf.features/spring/3.0.1/xml/features,mvn:org.opendaylight.integration/features-integration/0.2.2-Helium-SR2/xml/features,mvn:org.jolokia/jolokia-osgi/1.1.4/xml/features +featuresRepositories = mvn:org.apache.karaf.features/standard/3.0.1/xml/features,mvn:org.apache.karaf.features/enterprise/3.0.1/xml/features,mvn:org.ops4j.pax.web/pax-web-features/3.1.0/xml/features,mvn:org.apache.karaf.features/spring/3.0.1/xml/features,mvn:org.opendaylight.integration/features-integration/0.2.2-Helium-SR2/xml/features,mvn:org.jolokia/jolokia-osgi/1.1.5/xml/features # # Comma separated list of features to install at startup diff --git a/deploy/adapters/ansible/roles/odl_cluster/vars/Debian.yml b/deploy/adapters/ansible/roles/odl_cluster/vars/Debian.yml index c0e49019..a2a4795c 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/vars/Debian.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/vars/Debian.yml @@ -2,3 +2,8 @@ packages: - openjdk-7-jdk + - crudini + +service_file: + src: opendaylight.conf + dst: /etc/init/opendaylight.conf diff --git a/deploy/adapters/ansible/roles/odl_cluster/vars/RedHat.yml b/deploy/adapters/ansible/roles/odl_cluster/vars/RedHat.yml index 9c441d62..8becb8b6 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/vars/RedHat.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/vars/RedHat.yml @@ -2,3 +2,8 @@ packages: - java-1.7.0-openjdk + - crudini + +service_file: + - src: opendaylight.service + dst: /usr/lib/systemd/system/opendaylight.service diff --git a/deploy/adapters/ansible/roles/odl_cluster/vars/main.yml b/deploy/adapters/ansible/roles/odl_cluster/vars/main.yml index b98810a3..73a3b02e 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/vars/main.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/vars/main.yml @@ -3,7 +3,8 @@ odl_username: admin odl_password: admin odl_api_port: 8080 -odl_pkg_url: https://nexus.opendaylight.org/content/groups/public/org/opendaylight/integration/distribution-karaf/0.3.0-Lithium/distribution-karaf-0.3.0-Lithium.tar.gz +#odl_pkg_url: https://nexus.opendaylight.org/content/groups/public/org/opendaylight/integration/distribution-karaf/0.3.0-Lithium/distribution-karaf-0.3.0-Lithium.tar.gz +odl_pkg_url: karaf.tar.gz odl_pkg_name: karaf.tar.gz odl_home: "/opt/opendaylight-0.3.0/" odl_base_features: ['config', 'standard', 'region', 'package', 'kar', 'ssh', 'management', 'odl-restconf','odl-l2switch-switch','odl-openflowplugin-all','odl-mdsal-apidocs','odl-dlux-all','odl-adsal-northbound','odl-nsf-all','odl-ovsdb-openstack','odl-ovsdb-northbound','odl-dlux-core'] |