aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--defaults/main.yml3
-rw-r--r--tasks/rabbitmq_clustering.yml8
-rw-r--r--templates/erlang.cookie.j22
3 files changed, 10 insertions, 3 deletions
diff --git a/defaults/main.yml b/defaults/main.yml
index 2c7ea69..16191ff 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -2,7 +2,8 @@
2# defaults file for ansible-rabbitmq 2# defaults file for ansible-rabbitmq
3config_rabbitmq_ha: false #defines if rabbitmq ha should be configured...define here or in group_vars/group 3config_rabbitmq_ha: false #defines if rabbitmq ha should be configured...define here or in group_vars/group
4enable_rabbitmq_clustering: false #defines if setting up a rabbitmq cluster...define here or in group_vars/group 4enable_rabbitmq_clustering: false #defines if setting up a rabbitmq cluster...define here or in group_vars/group
5erlang_cookie: LSKNKBELKPSTDBBCHETL #define erlang cookie for cluster...define here or in group_vars/group 5#erlang_cookie: #define erlang cookie for cluster...define here or in group_vars/group
6erlang_cookie_file: /var/lib/rabbitmq/.erlang.cookie
6rabbitmq_config: 7rabbitmq_config:
7 - queue_name: logstash 8 - queue_name: logstash
8 durable: true 9 durable: true
diff --git a/tasks/rabbitmq_clustering.yml b/tasks/rabbitmq_clustering.yml
index c595db0..4d8dd0d 100644
--- a/tasks/rabbitmq_clustering.yml
+++ b/tasks/rabbitmq_clustering.yml
@@ -8,8 +8,14 @@
8- name: rabbitmq_clustering | stopping rabbitmq-server 8- name: rabbitmq_clustering | stopping rabbitmq-server
9 service: name=rabbitmq-server state=stopped 9 service: name=rabbitmq-server state=stopped
10 10
11- name: grabbing erlang cookie
12 shell: cat /var/lib/rabbitmq/.erlang.cookie
13 register: erlang_cookie
14 when: inventory_hostname == "{{ rabbitmq_master }}"
15
11- name: rabbitmq_clustering | copy erlang cookie 16- name: rabbitmq_clustering | copy erlang cookie
12 template: src=erlang.cookie.j2 dest=/var/lib/rabbitmq/.erlang.cookie owner=rabbitmq group=rabbitmq mode=0400 backup=yes 17 template: src=erlang.cookie.j2 dest={{ erlang_cookie_file }} owner=rabbitmq group=rabbitmq mode=0400 backup=yes
18 when: inventory_hostname != "{{ rabbitmq_master }}"
13 19
14- name: rabbitmq_clustering | restarting rabbitmq-server on master 20- name: rabbitmq_clustering | restarting rabbitmq-server on master
15 service: name=rabbitmq-server state=restarted 21 service: name=rabbitmq-server state=restarted
diff --git a/templates/erlang.cookie.j2 b/templates/erlang.cookie.j2
index cb398e7..2f1307e 100644
--- a/templates/erlang.cookie.j2
+++ b/templates/erlang.cookie.j2
@@ -1 +1 @@
{{ erlang_cookie }} {{ erlang_cookie.stdout }}