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/ansible/roles/odl_cluster/tasks | |
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/ansible/roles/odl_cluster/tasks')
-rw-r--r-- | deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml | 2 | ||||
-rw-r--r-- | deploy/adapters/ansible/roles/odl_cluster/tasks/main_compute.yml | 16 | ||||
-rw-r--r-- | deploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml (renamed from deploy/adapters/ansible/roles/odl_cluster/tasks/main_controller.yml) | 122 | ||||
-rw-r--r-- | deploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml | 40 |
4 files changed, 115 insertions, 65 deletions
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;" |