From 19b4493522b98f36fcfcecad774ff7868e003783 Mon Sep 17 00:00:00 2001 From: Larry Smith Jr Date: Sun, 9 Aug 2015 09:21:36 -0400 Subject: updated setting erlang cookie method --- defaults/main.yml | 3 ++- tasks/rabbitmq_clustering.yml | 8 +++++++- templates/erlang.cookie.j2 | 2 +- 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 @@ # defaults file for ansible-rabbitmq config_rabbitmq_ha: false #defines if rabbitmq ha should be configured...define here or in group_vars/group enable_rabbitmq_clustering: false #defines if setting up a rabbitmq cluster...define here or in group_vars/group -erlang_cookie: LSKNKBELKPSTDBBCHETL #define erlang cookie for cluster...define here or in group_vars/group +#erlang_cookie: #define erlang cookie for cluster...define here or in group_vars/group +erlang_cookie_file: /var/lib/rabbitmq/.erlang.cookie rabbitmq_config: - queue_name: logstash 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 @@ - name: rabbitmq_clustering | stopping rabbitmq-server service: name=rabbitmq-server state=stopped +- name: grabbing erlang cookie + shell: cat /var/lib/rabbitmq/.erlang.cookie + register: erlang_cookie + when: inventory_hostname == "{{ rabbitmq_master }}" + - name: rabbitmq_clustering | copy erlang cookie - template: src=erlang.cookie.j2 dest=/var/lib/rabbitmq/.erlang.cookie owner=rabbitmq group=rabbitmq mode=0400 backup=yes + template: src=erlang.cookie.j2 dest={{ erlang_cookie_file }} owner=rabbitmq group=rabbitmq mode=0400 backup=yes + when: inventory_hostname != "{{ rabbitmq_master }}" - name: rabbitmq_clustering | restarting rabbitmq-server on master 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 }} -- cgit v1.2.3