summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/open-contrail/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'deploy/adapters/ansible/roles/open-contrail/tasks')
-rwxr-xr-xdeploy/adapters/ansible/roles/open-contrail/tasks/main.yml3
-rw-r--r--deploy/adapters/ansible/roles/open-contrail/tasks/provision/-rabbitmq-stop.yml30
-rwxr-xr-xdeploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-add-nodes.yml16
-rw-r--r--deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-rabbitmq.yml87
4 files changed, 128 insertions, 8 deletions
diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/main.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/main.yml
index b1e9cbcd..16ca4e91 100755
--- a/deploy/adapters/ansible/roles/open-contrail/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/open-contrail/tasks/main.yml
@@ -74,6 +74,9 @@
# when: groups['opencontrail_control']|length !=0
+- name: Provision RabbitMQ on OpenContrail config nodes
+ include: provision/provision-rabbitmq.yml
+ when: inventory_hostname in groups['opencontrail']
- name: Provision increase limits for Open Contrail
include: provision/provision-increase-limits.yml
diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/-rabbitmq-stop.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/-rabbitmq-stop.yml
new file mode 100644
index 00000000..ec6b2fe0
--- /dev/null
+++ b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/-rabbitmq-stop.yml
@@ -0,0 +1,30 @@
+---
+- name: 'stop rabbitmq server'
+ service:
+ name: 'rabbitmq-server'
+ state: 'stopped'
+
+- name: 'check beam process'
+ shell: 'ps ax | grep -v grep | grep beam'
+ register: beam_process
+ changed_when: no
+ ignore_errors: yes
+
+- name: 'kill beam processes'
+ shell: 'pkill -9 beam'
+ when: beam_process.stdout
+
+- name: 'check epmd process'
+ shell: 'ps ax | grep -v grep | grep epmd'
+ register: epmd_process
+ changed_when: no
+ ignore_errors: yes
+
+- name: 'kill epmd processes'
+ shell: 'pkill -9 epmd'
+ when: epmd_process.stdout
+
+- name: 'remove mnesia directory'
+ file:
+ name: '/var/lib/rabbitmq/mnesia'
+ state: 'absent'
diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-add-nodes.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-add-nodes.yml
index aea12c00..91517b3d 100755
--- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-add-nodes.yml
+++ b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-add-nodes.yml
@@ -11,16 +11,16 @@
# sudo: yes
# tasks:
-- name: "recover rabbitmq-server service script"
- shell: cp /home/rabbitmq-server /etc/init.d/rabbitmq-server
+#- name: "recover rabbitmq-server service script"
+# shell: cp /home/rabbitmq-server /etc/init.d/rabbitmq-server
-- name: "restart rabbitmq-server"
- service:
- name: "rabbitmq-server"
- state: "restarted"
+#- name: "restart rabbitmq-server"
+# service:
+# name: "rabbitmq-server"
+# state: "restarted"
-- name: "wait rabbitmq-server start"
- shell: sleep 5
+#- name: "wait rabbitmq-server start"
+# shell: sleep 5
- name: "restart contrail-discovery"
service:
diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-rabbitmq.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-rabbitmq.yml
new file mode 100644
index 00000000..d3426590
--- /dev/null
+++ b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-rabbitmq.yml
@@ -0,0 +1,87 @@
+##############################################################################
+# 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
+##############################################################################
+---
+#- hosts: config
+# sudo: yes
+# tasks:
+- name: turn off rabbitmq server on control node
+ shell: sed -i '/rabbitmq-server/d' /opt/service ;
+
+- name: "start supervisor support service"
+ service:
+ name: "supervisor-support-service"
+ state: "started"
+
+- name: "stop rabbitmq server via supervisor"
+ supervisorctl:
+ name: "rabbitmq-server"
+ state: "stopped"
+ server_url: "unix:///tmp/supervisord_support_service.sock"
+
+- include: -rabbitmq-stop.yml
+
+- name: "update hosts"
+ lineinfile:
+ dest: "/etc/hosts"
+ line: "{{ ip_settings[item]['br-prv']['ip'] }}\t{{ hostvars[item]['ansible_hostname'] }} {{ hostvars[item]['ansible_hostname'] }}-ctrl"
+ with_items: groups['opencontrail']
+
+- name: "fix up rabbitmq env"
+ template:
+ src: "../../templates/provision/rabbitmq-env-conf.j2"
+ dest: "/etc/rabbitmq/rabbitmq-env.conf"
+
+- name: "fix up rabbitmq config for single node"
+ template:
+ src: "../../templates/provision/rabbitmq-conf-single.j2"
+ dest: "/etc/rabbitmq/rabbitmq.config"
+ when: groups['opencontrail'][1] is not defined
+
+- name: fix up rabbitmq config for multi nodes
+ template:
+ src: "../../templates/provision/rabbitmq-conf.j2"
+ dest: "/etc/rabbitmq/rabbitmq.config"
+ when: groups['opencontrail'][1] is defined
+
+- include: -rabbitmq-stop.yml
+
+#- name: "create cookie uuid temporary"
+# local_action:
+# module: "template"
+# src: "templates/rabbitmq-cookie.j2"
+# dest: "/tmp/tmp-rabbitmq-cookie"
+# run_once: yes
+#
+#- name: "update cookie uuid"
+# copy:
+# src: "/tmp/tmp-rabbitmq-cookie"
+# dest: "/var/lib/rabbitmq/.erlang.cookie"
+# owner: "rabbitmq"
+# group: "rabbitmq"
+# mode: 0400
+#
+#- name: "delete temporary cookie uuid"
+# local_action:
+# module: "file"
+# dest: "/tmp/tmp-rabbitmq-cookie"
+# state: "absent"
+# run_once: yes
+
+- name: "start rabbitmq server"
+ service:
+ name: "rabbitmq-server"
+ state: "started"
+
+- name: add rabbitmq user
+ shell: >
+ rabbitmqctl add_user {{ RABBIT_USER }} {{ RABBIT_PASS }} ;
+ rabbitmqctl set_permissions {{ RABBIT_USER }} ".*" ".*" ".*" ;
+
+- name: "check rabbitmq server"
+ shell: netstat -lpen --tcp | grep beam | grep 5672; while [ $? -ne 0 ]; do sleep 10; netstat -lpen --tcp | grep beam | grep 5672; done