````
---
# 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_file: '/var/lib/rabbitmq/.erlang.cookie'
+rabbitmq_config_ha: false #defines if rabbitmq ha should be configured...define here or in group_vars/group
+rabbitmq_enable_clustering: false #defines if setting up a rabbitmq cluster...define here or in group_vars/group
+rabbitmq_erlang_cookie: 'LSKNKBELKPSTDBBCHETL' #define erlang cookie for cluster...define here or in group_vars/group
+rabbitmq_erlang_cookie_file: '/var/lib/rabbitmq/.erlang.cookie'
rabbitmq_config:
- queue_name: logstash
durable: true
group_vars/rabbitmq-cluster-nodes
````
---
-enable_rabbitmq_clustering: true
-config_rabbitmq_ha: false
+rabbitmq_enable_clustering: true
+rabbitmq_config_ha: false
rabbitmq_master: ans-test-1
````
- hosts: all
become: true
vars:
- - config_rabbitmq_ha: true
- - enable_rabbitmq_clustering: true
+ - rabbitmq_config_ha: true
+ - rabbitmq_enable_clustering: true
- pri_domain_name: 'test.vagrant.local'
- rabbitmq_master: 'node0'
roles:
---
# 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_file: '/var/lib/rabbitmq/.erlang.cookie'
rabbitmq_config:
- - queue_name: logstash
+ - queue_name: 'logstash'
durable: true
exchange_name: logstash
- type: direct
- routing_key: logstash
+ type: 'direct'
+ routing_key: 'logstash'
tags: 'ha-mode=all,ha-sync-mode=automatic'
+rabbitmq_config_ha: false #defines if rabbitmq ha should be configured...define here or in group_vars/group
rabbitmq_debian_repo: 'deb http://www.rabbitmq.com/debian/ testing main'
rabbitmq_debian_repo_key: 'https://www.rabbitmq.com/rabbitmq-release-signing-key.asc'
+rabbitmq_enable_clustering: false #defines if setting up a rabbitmq cluster...define here or in group_vars/group
+rabbitmq_erlang_cookie: 'LSKNKBELKPSTDBBCHETL' #define erlang cookie for cluster...define here or in group_vars/group
+rabbitmq_erlang_cookie_file: '/var/lib/rabbitmq/.erlang.cookie'
rabbitmq_master: [] #defines the inventory host that should be considered master...define here or in group_vars/group
rabbitmq_redhat_repo_key: 'https://www.rabbitmq.com/rabbitmq-signing-key-public.asc'
rabbitmq_redhat_package: 'rabbitmq-server-{{ rabbitmq_redhat_version }}-1.noarch.rpm'
rabbitmq_redhat_url: 'http://www.rabbitmq.com/releases/rabbitmq-server/v{{ rabbitmq_redhat_version }}'
rabbitmq_redhat_version: '3.6.1'
rabbitmq_users: #define admin user to create in order to login to WebUI
- - name: rabbitmqadmin
- password: rabbitmqadmin
- vhost: /
+ - name: 'rabbitmqadmin'
+ password: 'rabbitmqadmin'
+ vhost: '/'
configure_priv: '.*'
read_priv: '.*'
write_priv: '.*'
- hosts: all
become: true
vars:
- - config_rabbitmq_ha: true
- - enable_rabbitmq_clustering: true
+ - rabbitmq_config_ha: true
+ - rabbitmq_enable_clustering: true
- pri_domain_name: 'test.vagrant.local'
- rabbitmq_master: 'node0'
roles:
register: clustered
- include: rabbitmq_clustering.yml
- when: enable_rabbitmq_clustering and (clustered.stat.exists != True)
+ when: rabbitmq_enable_clustering and (clustered.stat.exists != True)
- include: rabbitmq_ha_config.yml
- when: config_rabbitmq_ha and enable_rabbitmq_clustering
+ when: rabbitmq_config_ha and rabbitmq_enable_clustering
- include: rabbitmq_users.yml
#- name: grabbing erlang cookie
# shell: cat /var/lib/rabbitmq/.erlang.cookie
-# register: erlang_cookie
+# register: rabbitmq_erlang_cookie
# when: inventory_hostname == "{{ rabbitmq_master }}"
- name: rabbitmq_clustering | copy erlang cookie
template:
src: erlang.cookie.j2
- dest: "{{ erlang_cookie_file }}"
+ dest: "{{ rabbitmq_erlang_cookie_file }}"
owner: rabbitmq
group: rabbitmq
mode: 0400
tags: "{{ item.tags }}"
state: present
with_items: "{{ rabbitmq_users }}"
- when: (enable_rabbitmq_clustering is defined and not enable_rabbitmq_clustering) or enable_rabbitmq_clustering is not defined
+ when: (rabbitmq_enable_clustering is defined and not rabbitmq_enable_clustering) or rabbitmq_enable_clustering is not defined
- name: rabbitmq_users | creating rabbitmq users
rabbitmq_user:
state: present
run_once: yes
with_items: "{{ rabbitmq_users }}"
- when: (enable_rabbitmq_clustering is defined and enable_rabbitmq_clustering)
+ when: (rabbitmq_enable_clustering is defined and rabbitmq_enable_clustering)
-{{ erlang_cookie }}
+{{ rabbitmq_erlang_cookie }}