]> git.immae.eu Git - github/fretlink/ansible-rabbitmq.git/commitdiff
updated setting erlang cookie method
authorLarry Smith Jr <larry.e.smith.jr@gmail.com>
Sun, 9 Aug 2015 13:21:36 +0000 (09:21 -0400)
committerLarry Smith Jr <larry.e.smith.jr@gmail.com>
Sun, 9 Aug 2015 13:21:36 +0000 (09:21 -0400)
defaults/main.yml
tasks/rabbitmq_clustering.yml
templates/erlang.cookie.j2

index 2c7ea69c5486b32d5ab9e32250b8656cd46a9370..16191ffa72d7784c2d3ecc937050c56a2806db08 100644 (file)
@@ -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
index c595db0c4a6ca79f2eed24ea0fcf6204cfe4b37d..4d8dd0d37be58e0c05231ceeb0ba9368d960c5fd 100644 (file)
@@ -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
index cb398e71e176b67ad4e3698e9da74dd7f1b83fe3..2f1307ec3db36112a9973481f1575774a5c04d09 100644 (file)
@@ -1 +1 @@
-{{ erlang_cookie }}
+{{ erlang_cookie.stdout }}