diff options
author | liyuenan <liyuenan@huawei.com> | 2016-12-27 17:44:34 +0800 |
---|---|---|
committer | liyuenan <liyuenan@huawei.com> | 2017-01-05 09:42:35 +0800 |
commit | 92f6ca7bb6d7b2f295406aab34094b1dba76ff94 (patch) | |
tree | c4e62927a3bf9862f7ba9ce286cbece2c4335ef4 /deploy/adapters/ansible/roles/odl_cluster/tasks | |
parent | 6072a49adb33f2bce3f48b9c7b8be7d96cf8501c (diff) |
Yamllint test
JIRA: COMPASS-516
Change-Id: I482ce9bc86f4f963258c5b8823e0b00e83556eef
Signed-off-by: liyuenan <liyuenan@huawei.com>
Diffstat (limited to 'deploy/adapters/ansible/roles/odl_cluster/tasks')
15 files changed, 94 insertions, 62 deletions
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/01_00_download_packages.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_00_download_packages.yml index efd359db..ebca876a 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/tasks/01_00_download_packages.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_00_download_packages.yml @@ -13,22 +13,21 @@ register: http_server - name: download oracle-jdk8 package file - get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ jdk8_pkg_name }}" dest=/opt/{{ jdk8_pkg_name }} - -#" + get_url: + url: "http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ jdk8_pkg_name }}" + dest: /opt/{{ jdk8_pkg_name }} - name: download oracle-jdk8 script file - get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ jdk8_script_name }}" dest=/opt/ - -#" + get_url: + url: "http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ jdk8_script_name }}" + dest: /opt/ - name: download odl package - get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/odl/{{ 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 pip package - get_url: url="http://{{ http_server.stdout_lines[0] }}/pip/{{ networking_odl_pkg_name }}" dest=/opt/{{ networking_odl_pkg_name }} - -#" - + get_url: + url: "http://{{ http_server.stdout_lines[0] }}/pip/{{ networking_odl_pkg_name }}" + dest: /opt/{{ networking_odl_pkg_name }} diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/01_02_unarchive_odl_and_jdk.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_02_unarchive_odl_and_jdk.yml index ff82eba1..816e435a 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/tasks/01_02_unarchive_odl_and_jdk.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_02_unarchive_odl_and_jdk.yml @@ -15,4 +15,6 @@ command: su -s /bin/sh -c "/opt/install_jdk8/install_jdk8.sh" - name: extract odl package - 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 + 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 diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/01_03_copy_odl_configuration_files.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_03_copy_odl_configuration_files.yml index 8d71606f..f4e87955 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/tasks/01_03_copy_odl_configuration_files.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_03_copy_odl_configuration_files.yml @@ -49,5 +49,3 @@ template: src: jetty.xml dest: "{{ odl_home }}/etc/jetty.xml" - - diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/01_06_stop_openstack_services.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_06_stop_openstack_services.yml index f44b373b..7fc10e7d 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/tasks/01_06_stop_openstack_services.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_06_stop_openstack_services.yml @@ -8,7 +8,7 @@ ############################################################################## --- -- name: turn off neutron-server neutron-plugins-openvswitch-agent Daemon on control node +- name: turn off neutron server and agent Daemon on control node shell: > sed -i '/{{ service_ovs_agent_name }}/d' /opt/service ; sed -i '/neutron-server/d' /opt/service; diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/01_07_start_check_odl.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_07_start_check_odl.yml index 32fb885a..ee8c3585 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/tasks/01_07_start_check_odl.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_07_start_check_odl.yml @@ -26,4 +26,6 @@ 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 + shell: | + netstat -lpen --tcp | grep java | grep 6653; + while [ $? -ne 0 ]; do sleep 10; netstat -lpen --tcp | grep java grep 6653; done diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/01_08_configure_neutron.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_08_configure_neutron.yml index abb91c35..12c1fd25 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/tasks/01_08_configure_neutron.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_08_configure_neutron.yml @@ -9,26 +9,39 @@ --- - name: configure l2 configuration - shell: crudini --set /etc/neutron/l3_agent.ini DEFAULT external_network_bridge br-prv; + shell: | + crudini --set /etc/neutron/l3_agent.ini DEFAULT external_network_bridge \ + br-prv; when: odl_l3_agent == "Disable" - name: configure l3 configuration - shell: crudini --set /etc/neutron/l3_agent.ini DEFAULT external_network_bridge br-ex; + shell: | + crudini --set /etc/neutron/l3_agent.ini DEFAULT external_network_bridge \ + br-ex; when: odl_l3_agent == "Enable" - name: configure odl l3 driver - shell: crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins networking_odl.l3.l3_odl.OpenDaylightL3RouterPlugin; + shell: | + crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins \ + networking_odl.l3.l3_odl.OpenDaylightL3RouterPlugin; when: odl_l3_agent == "Enable" - name: configure metadata for l3 configuration - shell: crudini --set /etc/neutron/dhcp_agent.ini DEFAULT enable_isolated_metadata True; + shell: | + crudini --set /etc/neutron/dhcp_agent.ini DEFAULT \ + enable_isolated_metadata "True"; when: odl_l3_agent == "Enable" - 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 '{{ 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; + 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 \ + '{{ 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] tags: - test_odl diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/03_00_switch_off_neutron_openvswitch_agent.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_00_switch_off_neutron_openvswitch_agent.yml index 50359df4..08f8a07c 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/tasks/03_00_switch_off_neutron_openvswitch_agent.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_00_switch_off_neutron_openvswitch_agent.yml @@ -16,6 +16,8 @@ - name: remove Neutron's openvswitch agent services shell: > 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; + 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" diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/03_02_openvswitch_connect_opendaylight.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_02_openvswitch_connect_opendaylight.yml index 04f0ec61..f060e7bb 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/tasks/03_02_openvswitch_connect_opendaylight.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_02_openvswitch_connect_opendaylight.yml @@ -11,20 +11,23 @@ - name: restart keepalived to recover external IP before check br-int shell: service keepalived restart when: inventory_hostname in groups['odl'] - ignore_errors: True + ignore_errors: "True" -- name: restart opendaylight (for newton, opendaylight doesn't listen 6640 port, need restart) +- name: restart opendaylight shell: service opendaylight restart; sleep 60 when: inventory_hostname in groups['odl'] - ignore_errors: True + ignore_errors: "True" - name: set opendaylight as the manager - command: su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ internal_vip.ip }}:6640;" + 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 + shell: | + ovs-vsctl list-br | grep br-int; while [ $? -ne 0 ]; do sleep 10; \ + ovs-vsctl list-br | grep br-int; done - name: set local ip in openvswitch - shell: ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) other_config={'local_ip'=' {{ internal_ip }} '}; - -#' + shell: | + ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \ + other_config={'local_ip'=' {{ internal_ip }} '}; diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/03_03_00_recover_external_network_l3.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_03_00_recover_external_network_l3.yml index 7cf590a9..f315ebbf 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/tasks/03_03_00_recover_external_network_l3.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_03_00_recover_external_network_l3.yml @@ -8,7 +8,9 @@ ############################################################################## --- - name: check br-ex - shell: ovs-vsctl list-br | grep br-ex; while [ $? -ne 0 ]; do sleep 10; ovs-vsctl list-br | grep br-ex; done + shell: | + ovs-vsctl list-br | grep br-ex; + while [ $? -ne 0 ]; do sleep 10; ovs-vsctl list-br | grep br-ex; done - name: add ovs uplink openvswitch_port: bridge=br-ex port={{ item["interface"] }} state=present @@ -19,12 +21,14 @@ shell: sleep 10 - name: set external nic in openvswitch - shell: ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) other_config:provider_mappings=br-ex:{{ item["interface"] }} + shell: | + ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \ + other_config:provider_mappings=br-ex:{{ item["interface"] }} with_items: "{{ network_cfg['provider_net_mappings'] }}" when: item["type"] == "ovs" - name: copy recovery script - copy: src={{ item }} dest=/opt/setup_networks + copy: src={{ item }} dest=/opt/setup_networks with_items: - recover_network_odl_l3.py - setup_networks_odl_l3.py @@ -37,4 +41,5 @@ when: inventory_hostname in groups['odl'] - name: modify net-init - shell: sed -i 's/setup_networks.py/setup_networks_odl_l3.py/g' /etc/init.d/net_init + shell: sed -i 's/setup_networks.py/setup_networks_odl_l3.py/g' \ + /etc/init.d/net_init diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/03_03_01_recover_external_network_l2.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_03_01_recover_external_network_l2.yml index ad204cf9..54630898 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/tasks/03_03_01_recover_external_network_l2.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_03_01_recover_external_network_l2.yml @@ -13,12 +13,13 @@ when: item["type"] == "ovs" - name: add ovs uplink - openvswitch_port: bridge={{ item["name"] }} port={{ item["interface"] }} state=present + openvswitch_port: bridge={{ item["name"] }} port={{ item["interface"] }} + state=present with_items: "{{ network_cfg['provider_net_mappings'] }}" when: item["type"] == "ovs" - name: copy recovery script - copy: src={{ item }} dest=/opt/setup_networks + copy: src={{ item }} dest=/opt/setup_networks with_items: - recover_network.py diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/03_03_recover_external_network.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_03_recover_external_network.yml index 40963260..bffaf79f 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/tasks/03_03_recover_external_network.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_03_recover_external_network.yml @@ -19,4 +19,4 @@ - name: restart keepalived to recover external IP shell: service keepalived restart when: inventory_hostname in groups['odl'] - ignore_errors: True + ignore_errors: "True" diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/03_04_setup_ml2.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_04_setup_ml2.yml index 24149735..ae0dd6cc 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/tasks/03_04_setup_ml2.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_04_setup_ml2.yml @@ -10,9 +10,12 @@ - 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; + 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: copy ml2 configuration script template: diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/04_odl_l3_nova.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/04_odl_l3_nova.yml index 4e53f4aa..8a6435b5 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/tasks/04_odl_l3_nova.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/04_odl_l3_nova.yml @@ -12,4 +12,4 @@ shell: crudini --set /etc/nova/nova.conf DEFAULT force_config_drive true - name: restart all nova service - shell: for i in `cat /opt/service | grep nova` ; do service $i restart; done + shell: for i in `cat /opt/service | grep nova` ; do service $i restart; done diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/05_set_opendaylight_cluster.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/05_set_opendaylight_cluster.yml index 7eddf7fa..c9d93709 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/tasks/05_set_opendaylight_cluster.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/05_set_opendaylight_cluster.yml @@ -12,23 +12,23 @@ shell: rm -f /opt/cluster; touch /opt/cluster; - name: combine odl controller - shell: echo "{{ ip_settings[item.1]['mgmt']['ip'] }} \c" >> /opt/cluster; >> /opt/cluster; + shell: | + echo "{{ ip_settings[item.1]['mgmt']['ip'] }} \c" >> /opt/cluster; \ + >> /opt/cluster; with_indexed_items: groups['odl'] - name: combine odl controller shell: cat /opt/cluster register: cluster -#- debug: msg="{{ cluster.stdout_lines[0] }}" - - name: combine odl controller shell: uname -n | cut -b 5,5 register: number -#- debug: msg="{{ number.stdout_lines[0] }}" - -- debug: msg="{{ odl_home }}/bin/configure_cluster.sh {{ number.stdout_lines[0] }} {{ cluster.stdout_lines[0] }}" +- debug: msg="{{ odl_home }}/bin/configure_cluster.sh + {{ number.stdout_lines[0] }} {{ cluster.stdout_lines[0] }}" - name: configure odl controller in cluster - shell: "{{ odl_home }}/bin/configure_cluster.sh {{ number.stdout_lines[0] }} {{ cluster.stdout_lines[0] }}" - + shell: | + "{{ odl_home }}/bin/configure_cluster.sh {{ number.stdout_lines[0] }} \ + {{ cluster.stdout_lines[0] }}" diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/moon-odl.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/moon-odl.yml index b89b2823..ec05f6ce 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/tasks/moon-odl.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/moon-odl.yml @@ -19,13 +19,18 @@ shell: rm -rf {{ odl_home }}/system/org/opendaylight/aaa/ - name: download apache maven package file - get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/moon/apache-maven-3.3.9-bin.tar.gz" dest=/opt/apache-maven-3.3.9-bin.tar.gz + get_url: + url: "http://{{ http_server.stdout_lines[0] }}/packages/moon/apache-maven-3.3.9-bin.tar.gz" + dest: /opt/apache-maven-3.3.9-bin.tar.gz - name: create maven folder shell: mkdir -p /opt/apache-maven-3.3.9/ - name: extract maven - command: su -s /bin/sh -c "tar zxf /opt/apache-maven-3.3.9-bin.tar.gz -C /opt/apache-maven-3.3.9/ --strip-components 1 --no-overwrite-dir -k --skip-old-files" root + command: | + su -s /bin/sh -c "tar zxf /opt/apache-maven-3.3.9-bin.tar.gz -C \ + /opt/apache-maven-3.3.9/ --strip-components 1 --no-overwrite-dir -k \ + --skip-old-files" root - name: install maven shell: ln -s /opt/apache-maven-3.3.9/bin/mvn /usr/local/bin/mvn; @@ -36,18 +41,17 @@ - name: copy settings.xml template: src=settings.xml dest=/root/.m2/settings.xml -#- name: upload swift lib -# unarchive: src=odl-aaa-moon.tar.gz dest=/home/ - - name: download odl-aaa-moon package - get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/moon/{{ odl_aaa_moon }}" dest=/home/ + get_url: + url: "http://{{ http_server.stdout_lines[0] }}/packages/moon/{{ odl_aaa_moon }}" + dest: /home/ - name: unarchive odl-aaa-moon package command: su -s /bin/sh -c "tar xvf /home/{{ odl_aaa_moon }} -C /home/" - name: install aaa shell: > - export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/java-8-oracle/bin:/opt/apache-maven-3.3.3/bin"; + export PATH=$PATH:/usr/lib/jvm/java-8-oracle/bin:/opt/apache-maven-3.3.3/bin; export JAVA_HOME="/usr/lib/jvm/java-8-oracle"; export _JAVA_OPTIONS="-Djava.net.preferIPv4Stack=true"; export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=512m"; |