blob: 0431d82a49012329c45eca3e4fa08a9365df3844 (
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
##############################################################################
# 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: Install Crudini
# apt: name={{ item }} state=present
# with_items:
# - crudini
- name: install compute packages
action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
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 ;
- name: shut down and disable Neutron's openvswitch agent services
service: name=neutron-plugin-openvswitch-agent state=stopped
#- name: Stop the Open vSwitch service and clear existing OVSDB
# shell: >
# ovs-ofctl del-flows br-int ;
# ovs-vsctl del-br br-tun ;
# ovs-vsctl del-port br-int patch-tun;
# ovs-vsctl del-manager ;
#- name: Restart OpenVSwitch
# shell: service openvswitch-switch restart;
- 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;
- name: Check External network
shell: ovs-vsctl list-br | grep br-prv
register: extbr
- 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:{{ internal_vip.ip }}:6640;"
- name: set opendaylight as the manager
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
- name: set local ip in openvswitch
shell: ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) other_config={'local_ip'=' {{ internal_ip }} '};
#'
##################################################################
################ Recover External network #######################
##################################################################
- name: add ovs bridge
openvswitch_bridge: bridge={{ item["name"] }} state=present
with_items: "{{ network_cfg['provider_net_mappings'] }}"
when: item["type"] == "ovs" and extbr.rc == 0
- name: add ovs uplink
openvswitch_port: bridge={{ item["name"] }} port={{ item["interface"] }} state=present
with_items: "{{ network_cfg['provider_net_mappings'] }}"
when: item["type"] == "ovs" and extbr.rc == 0
- name: copy recovery script
copy: src={{ item }} dest=/opt/setup_networks
with_items:
- recover_network.py
when: extbr.rc == 0
- name: recover external script
shell: python /opt/setup_networks/recover_network.py
when: extbr.rc == 0
- name: restart keepalived
shell: service keepalived restart
when: inventory_hostname in groups['odl'] and extbr.rc == 0
ignore_errors: True
##################################################################
##################################################################
##################################################################
- 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;
#- name: Adjust Service Daemon
# shell: >
# sed -i '/neutron-plugin-openvswitch-agent/d' /opt/service ;
# echo opendaylight >> /opt/service ;
- name: copy ml2 configuration script
template:
src: ml2_conf.sh
dest: "/opt/ml2_conf.sh"
mode: 0777
- name: execute ml2 configuration script
command: su -s /bin/sh -c "/opt/ml2_conf.sh;"
|