diff options
author | grakiss <grakiss.wanglei@huawei.com> | 2016-03-04 03:32:34 -0500 |
---|---|---|
committer | grakiss <grakiss.wanglei@huawei.com> | 2016-03-04 03:37:36 -0500 |
commit | 77d64aa555766419280019f0e66bcf6d6cd70a7a (patch) | |
tree | 347b1b16d9521bb9105238af11a7e93054d87ab6 /deploy/adapters/ansible/roles | |
parent | b54d021a617657a52308d66b2a47e15c17e96f70 (diff) |
Support odl l2 on centos7
JIRA:COMPASS-331
- support odl l2 on centos7
Change-Id: Ibdf2840a7eb393ebf7f5d44aac80d6026a514588
Signed-off-by: grakiss <grakiss.wanglei@huawei.com>
Diffstat (limited to 'deploy/adapters/ansible/roles')
6 files changed, 53 insertions, 28 deletions
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml index 8ce25ae4..441ec2e2 100755 --- a/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml @@ -8,6 +8,8 @@ ############################################################################## --- - include_vars: "{{ ansible_os_family }}.yml" + tags: + - test_odl - name: Install ODL Cluster on Controller include: odl_controller.yml 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 846a71c7..5c9b203e 100755 --- a/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml @@ -76,7 +76,7 @@ template: src: "{{ service_file.src }}" dest: "{{ service_file.dst }}" - mode: 0644 + mode: 0755 - name: set l3 fwd enable in custom.properties template: @@ -85,7 +85,7 @@ owner: odl group: odl mode: 0775 - when: odl_l3_agent == "Enable" + when: odl_l3_agent == "Enable" - name: create karaf config template: @@ -176,15 +176,16 @@ ########################################################################################################## - 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 '/{{ service_ovs_agent_name }}/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 + when: ansible_os_family == "Debian" - name: chown opendaylight directory and files shell: > @@ -193,6 +194,15 @@ - name: start opendaylight service: name=opendaylight state=started + when: ansible_os_family == "Debian" + +- name: set opendaylight autostart + shell: chkconfig opendaylight on + when: ansible_os_family == "RedHat" + +- name: start opendaylight + shell: service opendaylight start + when: ansible_os_family == "RedHat" - 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 @@ -235,21 +245,6 @@ mysql -e "grant all on neutron.* to 'neutron'@'%' identified by '{{ NEUTRON_DBPASS }}';"; 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 - service: name=neutron-server state=started - -- name: add service daemon - shell: > - echo keepalived >> /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 + tags: + - test_odl diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml index 72182462..9c476bff 100755 --- a/deploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml @@ -18,24 +18,25 @@ with_items: compute_packages | union(compute_packages_noarch) - name: remove neutron-openvswitch-agent service daemon - shell: sed -i '/neutron-plugin-openvswitch-agent/d' /opt/service ; + shell: sed -i '/{{ service_ovs_agent_name }}/d' /opt/service ; - name: shut down and disable Neutron's openvswitch agent services - service: name=neutron-plugin-openvswitch-agent state=stopped + service: name={{ service_ovs_agent_name }} state=stopped enabled=no - name: remove Neutron's openvswitch agent services shell: > - update-rc.d -f neutron-plugin-openvswitch-agent remove; - mv /etc/init.d/neutron-plugin-openvswitch-agent /home/neutron-plugin-openvswitch-agent; - mv /etc/init/neutron-plugin-openvswitch-agent.conf /home/neutron-plugin-openvswitch-agent.conf; + update-rc.d -f {{ service_ovs_agent_name }} remove; + mv /etc/init.d/{{ service_ovs_agent_name }} /home/{{ service_ovs_agent_name }}; + mv /etc/init/{{ service_ovs_agent_name }}.conf /home/{{ service_ovs_agent_name }}.conf; + when: ansible_os_family == "Debian" - name: Stop the Open vSwitch service and clear existing OVSDB shell: > - service openvswitch-switch stop ; + service {{ service_ovs_name }} stop ; rm -rf /var/log/openvswitch/* ; rm -rf /etc/openvswitch/conf.db ; - service openvswitch-switch start ; + service {{ service_ovs_name }} start ; - name: set opendaylight as the manager command: su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ internal_vip.ip }}:6640;" diff --git a/deploy/adapters/ansible/roles/odl_cluster/vars/Debian.yml b/deploy/adapters/ansible/roles/odl_cluster/vars/Debian.yml index b76bce5a..a94d36c4 100755 --- a/deploy/adapters/ansible/roles/odl_cluster/vars/Debian.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/vars/Debian.yml @@ -15,6 +15,9 @@ controller_packages: compute_packages: - crudini +service_ovs_name: openvswitch-switch +service_ovs_agent_name: neutron-plugin-openvswitch-agent + 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 37c7dbc3..4446ebc6 100755 --- a/deploy/adapters/ansible/roles/odl_cluster/vars/RedHat.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/vars/RedHat.yml @@ -15,6 +15,8 @@ controller_packages: compute_packages: - crudini +service_ovs_name: openvswitch +service_ovs_agent_name: neutron-openvswitch-agent service_file: src: opendaylight diff --git a/deploy/adapters/ansible/roles/odl_cluster_post/tasks/main.yml b/deploy/adapters/ansible/roles/odl_cluster_post/tasks/main.yml index 8432186c..19e99e82 100755 --- a/deploy/adapters/ansible/roles/odl_cluster_post/tasks/main.yml +++ b/deploy/adapters/ansible/roles/odl_cluster_post/tasks/main.yml @@ -1,4 +1,26 @@ --- +- name: restart neutron-server + service: name=neutron-server state=restarted enabled=yes + when: inventory_hostname in groups['odl'] + +- name: add service daemon + shell: > + echo keepalived >> /opt/service ; + echo neutron-server >> /opt/service ; + when: inventory_hostname in groups['odl'] + +- name: restart neutron-l3-agent server + service: name=neutron-l3-agent state=restarted + when: inventory_hostname in groups['odl'] + +- name: restart neutron-dhcp-agent server + service: name=neutron-dhcp-agent state=restarted + when: inventory_hostname in groups['odl'] + +- name: restart neutron-metadata-agent server + service: name=neutron-metadata-agent state=restarted + when: inventory_hostname in groups['odl'] + - name: restart opendaylight shell: sleep 60; service opendaylight restart; sleep 300; when: inventory_hostname in groups['odl'] |