summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/mq/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'deploy/adapters/ansible/roles/mq/tasks')
-rw-r--r--deploy/adapters/ansible/roles/mq/tasks/main.yml17
-rw-r--r--deploy/adapters/ansible/roles/mq/tasks/rabbitmq_cluster.yml37
-rw-r--r--deploy/adapters/ansible/roles/mq/tasks/rabbitmq_config.yml23
-rwxr-xr-xdeploy/adapters/ansible/roles/mq/tasks/rabbitmq_install.yml91
4 files changed, 0 insertions, 168 deletions
diff --git a/deploy/adapters/ansible/roles/mq/tasks/main.yml b/deploy/adapters/ansible/roles/mq/tasks/main.yml
deleted file mode 100644
index 74be9ccb..00000000
--- a/deploy/adapters/ansible/roles/mq/tasks/main.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-##############################################################################
-# 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
-##############################################################################
----
-- include_vars: "{{ ansible_os_family }}.yml"
-
-- include: rabbitmq_install.yml
-
-- include: rabbitmq_config.yml
- when: inventory_hostname == haproxy_hosts.keys()[0]
-
-- meta: flush_handlers
diff --git a/deploy/adapters/ansible/roles/mq/tasks/rabbitmq_cluster.yml b/deploy/adapters/ansible/roles/mq/tasks/rabbitmq_cluster.yml
deleted file mode 100644
index b67df280..00000000
--- a/deploy/adapters/ansible/roles/mq/tasks/rabbitmq_cluster.yml
+++ /dev/null
@@ -1,37 +0,0 @@
-##############################################################################
-# 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 if i in the node list
- shell: |
- rabbitmqctl -q cluster_status | grep '\[{nodes,' \
- | grep {{ inventory_hostname }}
- changed_when: is_member.rc != 0
- failed_when: false
- register: is_member
- delegate_to: '{{ haproxy_hosts.keys()[0] }}'
-
-- name: stop rabbitmq app
- shell: |
- rabbitmqctl stop_app; sleep 5
- failed_when: false
- when: is_member.rc != 0
-
-- name: join cluster
- shell: rabbitmqctl join_cluster rabbit@{{ haproxy_hosts.keys()[0] }}
- register: join_result
- when: is_member.rc != 0
- until: join_result|success
- failed_when: join_result|failed and not 'already_member' in join_result.stderr
- changed_when: join_result|success
- retries: 20
- delay: 3
-
-- name: start rabbitmq app
- shell: rabbitmqctl start_app
- when: is_member.rc != 0
diff --git a/deploy/adapters/ansible/roles/mq/tasks/rabbitmq_config.yml b/deploy/adapters/ansible/roles/mq/tasks/rabbitmq_config.yml
deleted file mode 100644
index e26b81b4..00000000
--- a/deploy/adapters/ansible/roles/mq/tasks/rabbitmq_config.yml
+++ /dev/null
@@ -1,23 +0,0 @@
-##############################################################################
-# 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: remove default guest user is removed
- rabbitmq_user:
- user: guest
- state: absent
-
-- name: add rabbitmq user
- rabbitmq_user:
- user='{{ RABBIT_USER }}'
- password='{{ RABBIT_PASS }}'
- vhost=/
- configure_priv=.*
- write_priv=.*
- read_priv=.*
- state=present
diff --git a/deploy/adapters/ansible/roles/mq/tasks/rabbitmq_install.yml b/deploy/adapters/ansible/roles/mq/tasks/rabbitmq_install.yml
deleted file mode 100755
index 01a92efd..00000000
--- a/deploy/adapters/ansible/roles/mq/tasks/rabbitmq_install.yml
+++ /dev/null
@@ -1,91 +0,0 @@
-##############################################################################
-# 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: create rabbitmq directory
- file: path=/etc/rabbitmq state=directory mode=0755
-
-- name: disable auto start
- copy:
- content: "#!/bin/sh\nexit 101"
- dest: "/usr/sbin/policy-rc.d"
- mode: 0755
- when: ansible_os_family == "Debian"
-
-- name: install rabbitmq-server
- action: "{{ ansible_pkg_mgr }} name=rabbitmq-server state=present"
- with_items: "{{ packages | union(packages_noarch) }}"
-
-- name: enable auto start
- file:
- path=/usr/sbin/policy-rc.d
- state=absent
- when: ansible_os_family == "Debian"
-
-- name: make sure rabbitmq-server stopped
- service:
- name: rabbitmq-server
- state: stopped
- enabled: "yes"
-
-- name: replace cookie
- copy:
- content: "{{ ERLANG_TOKEN }}"
- dest: /var/lib/rabbitmq/.erlang.cookie
- mode: 0400
- owner: rabbitmq
- group: rabbitmq
-
-- name: replace config
- copy:
- content: "RABBITMQ_NODE_IP_ADDRESS={{ internal_ip }}"
- dest: /etc/rabbitmq/rabbitmq-env.conf
- mode: 0400
- owner: rabbitmq
- group: rabbitmq
-
-- name: set open file limit for rabbitmq
- copy:
- content: "ulimit -n 65536"
- dest: /etc/default/rabbitmq-server
- mode: 0400
- owner: rabbitmq
- group: rabbitmq
-
-- name: restart rabbitmq-server
- service:
- name: rabbitmq-server
- state: restarted
-
-- name: enable queue mirroring
- rabbitmq_policy:
- name: "ha-all"
- pattern: '^(?!amq\.).*'
- tags: "ha-mode=all"
-
-- name: get cluster name
- shell: |
- rabbitmqctl cluster_status | grep -w '<<"compass">>'
- register: cluster_status
- failed_when: false
- changed_when: cluster_status.rc != 0
- when: |
- inventory_hostname == haproxy_hosts.keys()[0]
-
-- name: set cluster name
- shell: rabbitmqctl set_cluster_name compass
- when: |
- inventory_hostname == haproxy_hosts.keys()[0]
- and cluster_status.rc != 0
-
-- include: rabbitmq_cluster.yml
- when: inventory_hostname != haproxy_hosts.keys()[0]
-
-- name: generate mq service list
- shell: echo {{ item }} >> /opt/service
- with_items: "{{ services_noarch }}"