aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/odl_cluster/roles/setup-odl/tasks
diff options
context:
space:
mode:
authorHarry Huang <huangxiangyu5@huawei.com>2017-08-23 15:05:02 +0800
committerHarry Huang <huangxiangyu5@huawei.com>2017-09-01 16:31:01 +0800
commit3bc3a8828c3ceefedd08e1767ae6e3bf2df9ac22 (patch)
tree7413e99b2d9ddbadc782a5e9f68a6f1ba35570b1 /plugins/odl_cluster/roles/setup-odl/tasks
parent292985dab007c3ee1c3481c985871a3483d9f7bc (diff)
Support multiple physnet mapping
JIRA: COMPASS-559 1. support multiple mapping in provider_net_mappings of network.yml and create corresponding ovs bridges 2. support seperate config in sys_intf_mappings of network.yml 3. remove linux bridges in compute nodes for ovs port binding convenience 4. support openstack vlan tenant network 5. modify odl and odl_sfc roles to use configurable provider mapping 6. remove some hard coding Change-Id: Ib57484ce60d029f89c647fd5baf2c7af37c85d0b Signed-off-by: Harry Huang <huangxiangyu5@huawei.com>
Diffstat (limited to 'plugins/odl_cluster/roles/setup-odl/tasks')
-rwxr-xr-xplugins/odl_cluster/roles/setup-odl/tasks/control-agents-1.yml39
-rwxr-xr-xplugins/odl_cluster/roles/setup-odl/tasks/control-agents-2.yml100
-rwxr-xr-xplugins/odl_cluster/roles/setup-odl/tasks/control-agents-3.yml69
-rwxr-xr-xplugins/odl_cluster/roles/setup-odl/tasks/control-db-1.yml8
-rwxr-xr-xplugins/odl_cluster/roles/setup-odl/tasks/control-hosts-1.yml100
-rwxr-xr-xplugins/odl_cluster/roles/setup-odl/tasks/control-hosts-2.yml23
-rwxr-xr-xplugins/odl_cluster/roles/setup-odl/tasks/control-repos-1.yml17
-rwxr-xr-xplugins/odl_cluster/roles/setup-odl/tasks/control-servers-1.yml15
-rwxr-xr-xplugins/odl_cluster/roles/setup-odl/tasks/control-servers-2.yml36
-rwxr-xr-xplugins/odl_cluster/roles/setup-odl/tasks/control-servers-3.yml19
-rwxr-xr-xplugins/odl_cluster/roles/setup-odl/tasks/main.yml4
-rwxr-xr-xplugins/odl_cluster/roles/setup-odl/tasks/odl-cluster.yml46
-rwxr-xr-xplugins/odl_cluster/roles/setup-odl/tasks/odl-post.yml34
-rwxr-xr-xplugins/odl_cluster/roles/setup-odl/tasks/odl-pre.yml46
14 files changed, 556 insertions, 0 deletions
diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-1.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-1.yml
new file mode 100755
index 00000000..dc071cc7
--- /dev/null
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-1.yml
@@ -0,0 +1,39 @@
+---
+
+- name: install crudini
+ package:
+ name: crudini
+ state: latest
+
+- name: install networking-odl
+ pip:
+ name: networking-odl
+ version: "{{ networking_odl_version }}"
+ virtualenv: /openstack/venvs/neutron-15.1.4
+
+- name: configure vsctl for dhcp agent
+ shell: |
+ crudini --set /etc/neutron/dhcp_agent.ini OVS \
+ ovsdb_interface vsctl;
+ when:
+ - inventory_hostname not in groups['nova_compute']
+
+- name: configure vsctl for l3 agent
+ shell: |
+ crudini --set /etc/neutron/l3_agent.ini OVS \
+ ovsdb_interface vsctl;
+ when: odl_l3_agent == "Disable" and inventory_hostname not in groups['nova_compute']
+
+- name: stop neutron l3 agent
+ service: name=neutron-l3-agent state=stopped enabled=no
+ when: odl_l3_agent == "Enable" and inventory_hostname not in groups['nova_compute']
+
+- name: shut down and disable Neutron's openvswitch agent services
+ service: name={{ service_ovs_agent_name }} state=stopped enabled=no
+
+- name: Stop the Open vSwitch service and clear existing OVSDB
+ shell: >
+ service {{ service_ovs_name }} stop ;
+ rm -rf /var/log/openvswitch/* ;
+ rm -rf /etc/openvswitch/conf.db ;
+ service {{ service_ovs_name }} start ;
diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-2.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-2.yml
new file mode 100755
index 00000000..82a26005
--- /dev/null
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-2.yml
@@ -0,0 +1,100 @@
+---
+
+- name: set opendaylight as the manager
+ command: |
+ su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ internal_lb_vip_address }}: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
+
+# yamllint disable rule:line-length
+- name: set local ip in openvswitch
+ shell: >
+ local_ip=$(grep local_ip /etc/neutron/plugins/ml2/openvswitch_agent.ini |
+ sed 's/local_ip =//g');
+ ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1)
+ other_config={'local_ip'="$local_ip"};
+ when: inventory_hostname not in groups['nova_compute']
+
+- name: set local ip in openvswitch
+ shell: >
+ local_ip=$(grep local_ip /etc/neutron/plugins/ml2/openvswitch_agent.ini |
+ sed 's/local_ip =//g');
+ ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1)
+ other_config={'local_ip'="$local_ip"};
+ when: inventory_hostname in groups['nova_compute']
+# yamllint enable rule:line-length
+
+- name: Setup br-provider
+ openvswitch_bridge:
+ bridge: "{{ public_bridge }}"
+ state: present
+ when:
+ - inventory_hostname not in groups['nova_compute']
+ - odl_l3_agent == "Disable"
+
+- name: add ovs uplink
+ openvswitch_port:
+ bridge: "{{ public_bridge }}"
+ port: "{{ contr_public_intf }}"
+ state: present
+ when:
+ - inventory_hostname not in groups['nova_compute']
+ - odl_l3_agent == "Disable"
+
+- name: set external nic in openvswitch
+ shell: |
+ ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \
+ other_config:provider_mappings={{ contr_l2_mappings }}
+ when:
+ - odl_l3_agent == "Disable"
+ - inventory_hostname not in groups['nova_compute']
+
+- name: set external nic in openvswitch
+ shell: |
+ ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \
+ other_config:provider_mappings={{ contr_l3_mappings }}
+ when:
+ - odl_l3_agent == "Enable"
+ - inventory_hostname not in groups['nova_compute']
+
+- name: set external nic in openvswitch
+ shell: |
+ ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \
+ other_config:provider_mappings={{ compu_l3_mappings }}
+ when:
+ - odl_l3_agent == "Enable"
+ - inventory_hostname in groups['nova_compute']
+
+- name: Set host OVS configurations
+ command: |
+ /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig \
+ --datapath_type=system --bridge_mappings={{ contr_l2_mappings }}
+ when:
+ - inventory_hostname not in groups['nova_compute']
+ - odl_l3_agent == "Disable"
+
+- name: Set host OVS configurations
+ command: |
+ /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig \
+ --datapath_type=system --bridge_mappings={{ contr_l3_mappings }}
+ when:
+ - inventory_hostname not in groups['nova_compute']
+ - odl_l3_agent == "Enable"
+
+- name: Set host OVS configurations
+ command: |
+ /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig --datapath_type=system
+ when:
+ - inventory_hostname in groups['nova_compute']
+ - odl_l3_agent == "Disable"
+
+- name: Set host OVS configurations
+ command: |
+ /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig
+ --datapath_type=system --bridge_mappings={{ compu_l3_mappings }}
+ when:
+ - inventory_hostname in groups['nova_compute']
+ - odl_l3_agent == "Enable"
diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-3.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-3.yml
new file mode 100755
index 00000000..2527852e
--- /dev/null
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-3.yml
@@ -0,0 +1,69 @@
+---
+
+- name: configure opendaylight -> ml2
+ shell: |
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight_v2;
+ 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 extension_drivers port_security;
+
+- name: configure bridge_mappings -> ml2
+ shell: |
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \
+ ovs bridge_mappings "{{ contr_l2_mappings }}";
+ when:
+ - odl_l3_agent == "Disable"
+ - inventory_hostname not in groups['nova_compute']
+
+- name: configure bridge_mappings -> ml2
+ shell: |
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \
+ ovs bridge_mappings "{{ compu_l2_mappings }}";
+ when:
+ - odl_l3_agent == "Disable"
+ - inventory_hostname in groups['nova_compute']
+
+- name: configure bridge_mappings for L3
+ shell: |
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \
+ ovs bridge_mappings "{{ contr_l3_mappings }}";
+ when:
+ - odl_l3_agent == "Enable"
+ - inventory_hostname not in groups['nova_compute']
+
+- name: configure bridge_mappings for L3
+ shell: |
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \
+ ovs bridge_mappings "{{ compu_l3_mappings }}";
+ when:
+ - odl_l3_agent == "Enable"
+ - inventory_hostname in groups['nova_compute']
+
+- name: configure external bridge name for L2
+ shell: |
+ crudini --set /etc/neutron/l3_agent.ini \
+ DEFAULT external_network_bridge "{{ public_bridge }}";
+ when: odl_l3_agent == "Disable"
+
+- name: configure opendaylight in ml2
+ shell: |
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl username admin;
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl password admin;
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl url \
+ http://{{ internal_lb_vip_address }}:8080/controller/nb/v2/neutron;
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl port_binding_controller \
+ pseudo-agentdb-binding;
+
+- name: configure metadata for l3 configuration
+ shell: |
+ crudini --set /etc/neutron/dhcp_agent.ini DEFAULT \
+ enable_isolated_metadata "True";
+ when:
+ - inventory_hostname not in groups['nova_compute']
+
+- name: force metadata for l3 configuration
+ shell: |
+ crudini --set /etc/neutron/dhcp_agent.ini DEFAULT \
+ force_metadata "True";
+ when:
+ - inventory_hostname not in groups['nova_compute']
diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-db-1.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-db-1.yml
new file mode 100755
index 00000000..3cef9792
--- /dev/null
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-db-1.yml
@@ -0,0 +1,8 @@
+---
+
+- 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_container_mysql_password }}';";
diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-hosts-1.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-hosts-1.yml
new file mode 100755
index 00000000..6879340e
--- /dev/null
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-hosts-1.yml
@@ -0,0 +1,100 @@
+---
+
+- name: check sdn_package cache
+ stat:
+ path=/opt/sdn_package.tar.gz
+ register: sdn_cache # Todo: remove hard code and add md5 check
+
+- name: debug
+ debug: msg="{{ sdn_cache }}"
+
+- name: get sdn_package
+ get_url:
+ url: "{{ sdn_package }}"
+ dest: /opt/
+ when: sdn_cache.stat.exists != 'true'
+
+- name: create odl group
+ group: name=odl system=yes state=present
+
+- name: create odl user
+ user:
+ name: odl
+ group: odl
+ home: "{{ odl_home }}"
+ createhome: "yes"
+ system: "yes"
+ shell: "/bin/false"
+
+- name: clear sdn_package
+ command: su -s /bin/sh -c "rm -rf /opt/sdn_package"
+
+- name: clear jdk8 package
+ command: su -s /bin/sh -c "rm -rf /opt/install_jdk8"
+
+- name: unarchive sdn_package
+ command: su -s /bin/sh -c "tar xzf /opt/sdn_package.tar.gz -C /opt/"
+
+- name: copy java package
+ command: su -s /bin/sh -c "cp /opt/sdn_package/java/jdk-8u51-linux-x64.tar.gz /opt/"
+
+- name: unarchive java_install package
+ command: su -s /bin/sh -c "tar xvf /opt/sdn_package/java/install_jdk8.tar -C /opt/"
+
+- name: install java
+ command: su -s /bin/sh -c "/opt/install_jdk8/install_jdk8.sh"
+
+- name: clear odl package
+ command: su -s /bin/sh -c "rm -rf {{ odl_home }}*"
+
+- name: extract odl package
+ command: |
+ su -s /bin/sh -c "tar xzf /opt/sdn_package/odl/{{ odl_pkg_name }} -C {{ odl_home }} \
+ --strip-components 1" odl
+
+- name: opendaylight system file
+ copy:
+ src: "{{ service_file.src }}"
+ dest: "{{ service_file.dst }}"
+ mode: 0755
+
+- name: set l3 fwd enable in custom.properties
+ template:
+ src: custom.properties
+ dest: "{{ odl_home }}/etc/custom.properties"
+ owner: odl
+ group: odl
+ mode: 0775
+ when: odl_l3_agent == "Enable"
+
+- name: create karaf config
+ template:
+ src: org.apache.karaf.features.cfg
+ dest: "{{ odl_home }}/etc/org.apache.karaf.features.cfg"
+ owner: odl
+ group: odl
+ mode: 0775
+
+- name: copy acl configuration script
+ template:
+ src: acl_conf.sh
+ dest: "/opt/acl_conf.sh"
+ mode: 0777
+
+- name: execute acl configuration script
+ command: su -s /bin/sh -c "/opt/acl_conf.sh;" odl
+
+- name: create jetty config
+ shell: >
+ sed -i 's/default="8181"/default="8081"/'
+ {{ odl_home }}etc/jetty.xml
+
+- name: create tomcat config
+ shell: >
+ sed -i 's/port="8282"/port="8081"/'
+ {{ odl_home }}configuration/tomcat-server.xml
+
+- name: remove karaf data directory
+ file:
+ path: "{{ odl_home }}data"
+ state: absent
diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-hosts-2.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-hosts-2.yml
new file mode 100755
index 00000000..b8d9403a
--- /dev/null
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-hosts-2.yml
@@ -0,0 +1,23 @@
+---
+
+- name: chown opendaylight directory and files
+ shell: >
+ chown -R odl:odl "{{ odl_home }}";
+ chown odl:odl "{{ service_file.dst }}";
+
+- 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
diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-repos-1.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-repos-1.yml
new file mode 100755
index 00000000..8427e4f0
--- /dev/null
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-repos-1.yml
@@ -0,0 +1,17 @@
+---
+
+- name: download networking-odl
+ get_url:
+ url: "{{ odl_pip }}"
+ dest: /var/www/repo/os-releases/15.1.4/ubuntu-16.04-x86_64
+
+- name: patch networking-odl to fix a bug
+ shell: |
+ cd /var/www/repo/os-releases/15.1.4/ubuntu-16.04-x86_64/
+ tar -zxf networking-odl-4.0.0.tar.gz # hard code, need to modify
+ rm -rf networking-odl-4.0.0.tar.gz
+ sed -i 's/^Babel.*/Babel!=2.4.0,>=2.3.4/' networking-odl-4.0.0/requirements.txt
+ tar -zcf networking-odl-4.0.0.tar.gz networking-odl-4.0.0/
+ rm -rf networking-odl-4.0.0/
+ pip install networking-odl-4.0.0.tar.gz -d ./
+ cd -
diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-1.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-1.yml
new file mode 100755
index 00000000..459c734a
--- /dev/null
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-1.yml
@@ -0,0 +1,15 @@
+---
+
+- name: install crudini
+ package:
+ name: crudini
+ state: latest
+
+- name: install networking-odl
+ pip:
+ name: networking-odl
+ version: "{{ networking_odl_version }}"
+ virtualenv: /openstack/venvs/neutron-15.1.4 # Todo: hardcode, need to modify
+
+- name: turn off neutron-server on control node
+ service: name=neutron-server state=stopped
diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-2.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-2.yml
new file mode 100755
index 00000000..a5d31d4c
--- /dev/null
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-2.yml
@@ -0,0 +1,36 @@
+---
+
+- name: configure odl l3 driver
+ shell: |
+ crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins \
+ odl-router,metering;
+ when: odl_l3_agent == "Enable"
+
+- name: configure opendaylight -> ml2
+ shell: >
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight_v2;
+ 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 extension_drivers port_security;
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings
+ "{{ contr_l2_mappings }}";
+
+- name: configure bridge_mappings for L3
+ shell: >
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings
+ "{{ contr_l3_mappings }}";
+ when: odl_l3_agent == "Enable"
+
+- name: turn off l3 ha for odl l2
+ shell: |
+ crudini --set /etc/neutron/neutron.conf DEFAULT l3_ha "False";
+ when: odl_l3_agent == "Disable"
+
+- name: configure opendaylight in ml2
+ shell: |
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl username admin;
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl password admin;
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl url \
+ http://{{ internal_lb_vip_address }}:8080/controller/nb/v2/neutron;
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl port_binding_controller \
+ pseudo-agentdb-binding;
diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-3.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-3.yml
new file mode 100755
index 00000000..3d5c307b
--- /dev/null
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-3.yml
@@ -0,0 +1,19 @@
+---
+
+- name: Perform a Neutron DB online upgrade
+ command: |
+ /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage
+ --config-file /etc/neutron/neutron.conf
+ --config-file /etc/neutron/plugins/ml2/ml2_conf.ini
+ upgrade --expand
+ become: "yes"
+ become_user: "neutron"
+
+- name: Perform a Neutron DB offline upgrade
+ command: |
+ /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage
+ --config-file /etc/neutron/neutron.conf
+ --config-file /etc/neutron/plugins/ml2/ml2_conf.ini
+ upgrade --contract
+ become: "yes"
+ become_user: "neutron"
diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/main.yml b/plugins/odl_cluster/roles/setup-odl/tasks/main.yml
new file mode 100755
index 00000000..e65be002
--- /dev/null
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/main.yml
@@ -0,0 +1,4 @@
+---
+
+- include: odl-cluster.yml
+ when: opendaylight is defined and opendaylight == "Enable"
diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/odl-cluster.yml b/plugins/odl_cluster/roles/setup-odl/tasks/odl-cluster.yml
new file mode 100755
index 00000000..5b57fb00
--- /dev/null
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/odl-cluster.yml
@@ -0,0 +1,46 @@
+---
+
+- include_vars: "{{ ansible_os_family }}.yml"
+
+- include_vars: "{{ openstack_passwd_file }}"
+
+- include: odl-pre.yml
+ when: inventory_hostname == "localhost"
+
+- include_vars: /tmp/odl-extra-vars.yml
+
+- include: control-hosts-1.yml
+ when: inventory_hostname in groups['network_hosts'] # Todo: modify to odl_hosts
+
+- include: control-repos-1.yml
+ vars:
+ odl_pip: "{{ networking_odl_url }}"
+ when: inventory_hostname in groups['repo_container']
+
+- include: control-servers-1.yml
+ when: inventory_hostname in groups['neutron_server']
+
+- include: control-agents-1.yml
+ when: inventory_hostname in groups['neutron_openvswitch_agent']
+
+- include: control-hosts-2.yml
+ when: inventory_hostname in groups['network_hosts'] # Todo: modify to odl_hosts
+
+- include: control-agents-2.yml
+ when: inventory_hostname in groups['neutron_openvswitch_agent']
+
+- include: control-servers-2.yml
+ when: inventory_hostname in groups['neutron_server']
+
+- include: control-agents-3.yml
+ when: inventory_hostname in groups['neutron_openvswitch_agent']
+
+- include: control-db-1.yml
+ when: inventory_hostname == groups['galera_container'][0]
+
+- include: control-servers-3.yml
+ when:
+ - inventory_hostname in groups['neutron_server'][0]
+ - inventory_hostname not in groups['network_hosts']
+
+- include: odl-post.yml
diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/odl-post.yml b/plugins/odl_cluster/roles/setup-odl/tasks/odl-post.yml
new file mode 100755
index 00000000..9f1cb79e
--- /dev/null
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/odl-post.yml
@@ -0,0 +1,34 @@
+---
+
+- name: restart neutron-server
+ service: name=neutron-server state=restarted enabled=yes
+ when: inventory_hostname in groups['neutron_server']
+
+- name: restart neutron-l3-agent server
+ service: name=neutron-l3-agent state=restarted
+ when:
+ - odl_l3_agent == "Disable"
+ - inventory_hostname in groups['neutron_openvswitch_agent']
+ - inventory_hostname not in groups['nova_compute']
+
+- name: restart neutron-dhcp-agent server
+ service: name=neutron-dhcp-agent state=restarted
+ when:
+ - inventory_hostname in groups['neutron_openvswitch_agent']
+ - inventory_hostname not in groups['nova_compute']
+
+- name: restart neutron-metadata-agent server
+ service: name=neutron-metadata-agent state=restarted
+ when:
+ - inventory_hostname in groups['neutron_openvswitch_agent']
+ - inventory_hostname not in groups['nova_compute']
+
+- name: remove karaf data directory
+ file:
+ path: "{{ odl_home }}data"
+ state: absent
+ when: inventory_hostname in groups['network_hosts']
+
+- name: restart opendaylight
+ shell: sleep 60; service opendaylight restart; sleep 60;
+ when: inventory_hostname in groups['network_hosts']
diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/odl-pre.yml b/plugins/odl_cluster/roles/setup-odl/tasks/odl-pre.yml
new file mode 100755
index 00000000..64631663
--- /dev/null
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/odl-pre.yml
@@ -0,0 +1,46 @@
+---
+
+- name: set l2_mapping l3_mapping
+ copy:
+ dest: /tmp/odl-extra-vars.yml
+ content: |
+ {% set contr_l2_list = [] %}
+ {% set contr_l3_list = [] %}
+ {% set pub_l2_mapping = [] %}
+ {% set pub_l3_mapping = [] %}
+ {% set pub_intf = [] %}
+ {% set pub_bridge = [] %}
+ {% for key, value in contr_prv_mappings.iteritems() %}
+ {% set l2_mapping = key + ":" + value["bridge"] %}
+ {% set l3_mapping = key + ":" + value["interface"] %}
+ {% set _ = contr_l2_list.append(l2_mapping) %}
+ {% set _ = contr_l3_list.append(l3_mapping) %}
+ {% if key == public_net_info["provider_network"] %}
+ {% set _ = pub_l2_mapping.append(l2_mapping) %}
+ {% set _ = pub_l3_mapping.append(l3_mapping) %}
+ {% set _ = pub_intf.append(value["interface"]) %}
+ {% set _ = pub_bridge.append(value["bridge"]) %}
+ {% endif %}
+ {% endfor %}
+ {% set compu_l2_list = [] %}
+ {% set compu_l3_list = [] %}
+ {% set compu_pub_intf = compu_sys_mappings["external"]["interface"] %}
+ {% set compu_pub_vlan = compu_sys_mappings["external"]["vlan_tag"] %}
+ {% if compu_pub_vlan | int %}
+ {% set compu_pub_intf = compu_pub_intf + '.' + compu_pub_vlan|string %}
+ {% endif %}
+ {% for key, value in compu_prv_mappings.iteritems() %}
+ {% set l2_mapping = key + ":" + value["bridge"] %}
+ {% set l3_mapping = key + ":" + value["interface"] %}
+ {% set _ = compu_l2_list.append(l2_mapping) %}
+ {% set _ = compu_l3_list.append(l3_mapping) %}
+ {% endfor %}
+ {% set pub_l3_mapping = pub_l3_mapping[0].replace(pub_intf[0], compu_pub_intf) %}
+ {% set _ = compu_l2_list.append(pub_l2_mapping[0]) %}
+ {% set _ = compu_l3_list.append(pub_l3_mapping) %}
+ public_bridge: "{{ pub_bridge[0] }}"
+ contr_public_intf: "{{ pub_intf[0] }}"
+ contr_l2_mappings: "{{ ','.join(contr_l2_list) }}"
+ contr_l3_mappings: "{{ ','.join(contr_l3_list) }}"
+ compu_l2_mappings: "{{ ','.join(compu_l2_list) }}"
+ compu_l3_mappings: "{{ ','.join(compu_l3_list) }}"