aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/odl_cluster/tasks/03_03_00_recover_external_network_l3.yml
blob: f315ebbfd83a6f26b03425bf8d33b95b4323eec2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
##############################################################################
# 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