summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/odl_cluster/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'deploy/adapters/ansible/roles/odl_cluster/tasks')
-rw-r--r--deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml10
-rw-r--r--deploy/adapters/ansible/roles/odl_cluster/tasks/main_compute.yml16
-rw-r--r--deploy/adapters/ansible/roles/odl_cluster/tasks/main_controller.yml149
3 files changed, 175 insertions, 0 deletions
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml
new file mode 100644
index 00000000..1b27ed14
--- /dev/null
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml
@@ -0,0 +1,10 @@
+---
+- include_vars: "{{ ansible_os_family }}.yml"
+
+- name: Install ODL Cluster on Controller
+ include: main_controller.yml
+ when: inventory_hostname in groups['controller']
+
+- name: Install ODL Cluster on Compute
+ include: main_compute.yml
+ when: inventory_hostname in groups['compute']
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/main_compute.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/main_compute.yml
new file mode 100644
index 00000000..39947661
--- /dev/null
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/main_compute.yml
@@ -0,0 +1,16 @@
+---
+- name: shut down and disable Neutron's agent services
+ service: name=neutron-plugin-openvswitch-agent state=stopped
+
+- 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:{{odl_controller}}:6640;"
+
+- name: start and disable Neutron's agent services
+ service: name=neutron-plugin-openvswitch-agent state=started
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/main_controller.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/main_controller.yml
new file mode 100644
index 00000000..751af715
--- /dev/null
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/main_controller.yml
@@ -0,0 +1,149 @@
+---
+- name: install jdk packages
+ action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
+ with_items: packages | union(packages_noarch)
+
+#- name: install opendaylight packages
+# apt: name={{ item }} state=present
+# with_items:
+# - openjdk-8-jdk
+
+#- name: create odl directories
+# file:
+# path: /opt/opendaylight-0.2.2
+# state: "directory"
+# group: root
+# owner: root
+# mode: 0755
+
+- 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: download odl package
+ get_url: url={{ odl_pkg_url }} dest=/opt/{{ odl_pkg_name }}
+
+# TODO: unarchive doesn't support strip-component at the moment
+# TODO: switch to use untar after support is added.
+- name: extract odl package
+# unarchive: src=/opt/{{ odl_pkg_name }} dest={{ odl_home }} group=odl owner=odl mode=0775 copy=no
+ 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
+ notify:
+ - restart odl service
+
+#- name: opendaylight systemd file
+# template: src=opendaylight.service dest=/usr/lib/systemd/system/opendaylight.service mode=0644
+
+- 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
+ notify:
+ - restart odl service
+
+- name: create tomcat config
+ template:
+ src: tomcat-server.xml
+ dest: "{{ odl_home }}/configuration/tomcat-server.xml"
+ notify:
+ - restart odl service
+
+#- name: restart odl service
+# service: name=opendaylight state=started pattern="opendaylight"
+
+##########################################################################################################
+################################# OpenDayLight Cluster Configuration #################################
+##########################################################################################################
+- name: create initial directory
+ shell: >
+ mkdir -p {{ odl_home }}/configuration/initial;
+
+- name: create akka config
+ template:
+ src: akka.conf
+ dest: "{{ odl_home }}/configuration/initial/akka.conf"
+ notify:
+ - restart odl service
+
+
+- name: create module-shards config
+ template:
+ src: module-shards.conf
+ dest: "{{ odl_home }}/configuration/initial/module-shards.conf"
+ notify:
+ - restart odl service
+
+- name: copy Jolokia-OSGi config
+ shell: >
+ cp -r jolokia {{ odl_home }}/system/org/;
+
+- name: remove KARAF Data Directory
+ shell: >
+ rm -rf {{ odl_home }}/data/*;
+
+
+##########################################################################################################
+################################ OpenDayLight connect with OpenStack ################################
+##########################################################################################################
+- name: Turn off neutron-server on control node
+ service: name=neutron-server state=stopped
+
+- name: shut down and disable Neutron's agent services
+ service: name=neutron-plugin-openvswitch-agent state=stopped
+
+- 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:{{odl_controller}}:6640;"
+
+- name: start and disable Neutron's agent services
+ service: name=neutron-plugin-openvswitch-agent state=started
+
+- name: Install Crudini
+ apt: name={{ item }} state=present
+ with_items:
+ - crudini
+
+- name: Configure Neutron1
+ 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;
+
+- name: Create ML2 Configuration File
+ template:
+ src: ml2_conf.sh
+ dest: "/opt/ml2_conf.sh"
+ mode: 0777
+
+- name: Configure Neutron2
+ command: su -s /bin/sh -c "/opt/ml2_conf.sh;"
+
+- name: Configure Neutron3
+ shell: >
+ mysql -e "drop database if exists neutron_ml2;";
+ mysql -e "create database neutron_ml2 character set utf8;";
+ mysql -e "grant all on neutron_ml2.* to 'neutron'@'%';";
+ 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;
+
+- name: Restart neutron-server
+ service: name=neutron-server state=started
+
+
+
+