############################################################################## # Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## --- - 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 - name: add ovs uplink openvswitch_port: bridge=br-ex port={{ item["interface"] }} state=present with_items: "{{ network_cfg['provider_net_mappings'] }}" when: item["type"] == "ovs" - name: wait 10 seconds 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"] }} with_items: "{{ network_cfg['provider_net_mappings'] }}" when: item["type"] == "ovs" - name: copy recovery script copy: src={{ item }} dest=/opt/setup_networks with_items: - recover_network_odl_l3.py - setup_networks_odl_l3.py - name: recover external script shell: python /opt/setup_networks/recover_network_odl_l3.py - name: update keepalived info template: src=keepalived.conf dest=/etc/keepalived/keepalived.conf 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