diff options
-rw-r--r-- | README.md | 16 | ||||
-rw-r--r-- | defaults/main.yml | 20 | ||||
-rw-r--r-- | playbook.yml | 4 | ||||
-rw-r--r-- | tasks/main.yml | 4 | ||||
-rw-r--r-- | tasks/rabbitmq_clustering.yml | 4 | ||||
-rw-r--r-- | tasks/rabbitmq_users.yml | 4 | ||||
-rw-r--r-- | templates/erlang.cookie.j2 | 2 |
7 files changed, 27 insertions, 27 deletions
@@ -31,10 +31,10 @@ Role Variables | |||
31 | ```` | 31 | ```` |
32 | --- | 32 | --- |
33 | # defaults file for ansible-rabbitmq | 33 | # defaults file for ansible-rabbitmq |
34 | config_rabbitmq_ha: false #defines if rabbitmq ha should be configured...define here or in group_vars/group | 34 | rabbitmq_config_ha: false #defines if rabbitmq ha should be configured...define here or in group_vars/group |
35 | enable_rabbitmq_clustering: false #defines if setting up a rabbitmq cluster...define here or in group_vars/group | 35 | rabbitmq_enable_clustering: false #defines if setting up a rabbitmq cluster...define here or in group_vars/group |
36 | erlang_cookie: 'LSKNKBELKPSTDBBCHETL' #define erlang cookie for cluster...define here or in group_vars/group | 36 | rabbitmq_erlang_cookie: 'LSKNKBELKPSTDBBCHETL' #define erlang cookie for cluster...define here or in group_vars/group |
37 | erlang_cookie_file: '/var/lib/rabbitmq/.erlang.cookie' | 37 | rabbitmq_erlang_cookie_file: '/var/lib/rabbitmq/.erlang.cookie' |
38 | rabbitmq_config: | 38 | rabbitmq_config: |
39 | - queue_name: logstash | 39 | - queue_name: logstash |
40 | durable: true | 40 | durable: true |
@@ -63,8 +63,8 @@ example... | |||
63 | group_vars/rabbitmq-cluster-nodes | 63 | group_vars/rabbitmq-cluster-nodes |
64 | ```` | 64 | ```` |
65 | --- | 65 | --- |
66 | enable_rabbitmq_clustering: true | 66 | rabbitmq_enable_clustering: true |
67 | config_rabbitmq_ha: false | 67 | rabbitmq_config_ha: false |
68 | rabbitmq_master: ans-test-1 | 68 | rabbitmq_master: ans-test-1 |
69 | ```` | 69 | ```` |
70 | 70 | ||
@@ -95,8 +95,8 @@ Example Playbook | |||
95 | - hosts: all | 95 | - hosts: all |
96 | become: true | 96 | become: true |
97 | vars: | 97 | vars: |
98 | - config_rabbitmq_ha: true | 98 | - rabbitmq_config_ha: true |
99 | - enable_rabbitmq_clustering: true | 99 | - rabbitmq_enable_clustering: true |
100 | - pri_domain_name: 'test.vagrant.local' | 100 | - pri_domain_name: 'test.vagrant.local' |
101 | - rabbitmq_master: 'node0' | 101 | - rabbitmq_master: 'node0' |
102 | roles: | 102 | roles: |
diff --git a/defaults/main.yml b/defaults/main.yml index 4923974..ad22ead 100644 --- a/defaults/main.yml +++ b/defaults/main.yml | |||
@@ -1,27 +1,27 @@ | |||
1 | --- | 1 | --- |
2 | # defaults file for ansible-rabbitmq | 2 | # defaults file for ansible-rabbitmq |
3 | config_rabbitmq_ha: false #defines if rabbitmq ha should be configured...define here or in group_vars/group | ||
4 | enable_rabbitmq_clustering: false #defines if setting up a rabbitmq cluster...define here or in group_vars/group | ||
5 | erlang_cookie: 'LSKNKBELKPSTDBBCHETL' #define erlang cookie for cluster...define here or in group_vars/group | ||
6 | erlang_cookie_file: '/var/lib/rabbitmq/.erlang.cookie' | ||
7 | rabbitmq_config: | 3 | rabbitmq_config: |
8 | - queue_name: logstash | 4 | - queue_name: 'logstash' |
9 | durable: true | 5 | durable: true |
10 | exchange_name: logstash | 6 | exchange_name: logstash |
11 | type: direct | 7 | type: 'direct' |
12 | routing_key: logstash | 8 | routing_key: 'logstash' |
13 | tags: 'ha-mode=all,ha-sync-mode=automatic' | 9 | tags: 'ha-mode=all,ha-sync-mode=automatic' |
10 | rabbitmq_config_ha: false #defines if rabbitmq ha should be configured...define here or in group_vars/group | ||
14 | rabbitmq_debian_repo: 'deb http://www.rabbitmq.com/debian/ testing main' | 11 | rabbitmq_debian_repo: 'deb http://www.rabbitmq.com/debian/ testing main' |
15 | rabbitmq_debian_repo_key: 'https://www.rabbitmq.com/rabbitmq-release-signing-key.asc' | 12 | rabbitmq_debian_repo_key: 'https://www.rabbitmq.com/rabbitmq-release-signing-key.asc' |
13 | rabbitmq_enable_clustering: false #defines if setting up a rabbitmq cluster...define here or in group_vars/group | ||
14 | rabbitmq_erlang_cookie: 'LSKNKBELKPSTDBBCHETL' #define erlang cookie for cluster...define here or in group_vars/group | ||
15 | rabbitmq_erlang_cookie_file: '/var/lib/rabbitmq/.erlang.cookie' | ||
16 | rabbitmq_master: [] #defines the inventory host that should be considered master...define here or in group_vars/group | 16 | rabbitmq_master: [] #defines the inventory host that should be considered master...define here or in group_vars/group |
17 | rabbitmq_redhat_repo_key: 'https://www.rabbitmq.com/rabbitmq-signing-key-public.asc' | 17 | rabbitmq_redhat_repo_key: 'https://www.rabbitmq.com/rabbitmq-signing-key-public.asc' |
18 | rabbitmq_redhat_package: 'rabbitmq-server-{{ rabbitmq_redhat_version }}-1.noarch.rpm' | 18 | rabbitmq_redhat_package: 'rabbitmq-server-{{ rabbitmq_redhat_version }}-1.noarch.rpm' |
19 | rabbitmq_redhat_url: 'http://www.rabbitmq.com/releases/rabbitmq-server/v{{ rabbitmq_redhat_version }}' | 19 | rabbitmq_redhat_url: 'http://www.rabbitmq.com/releases/rabbitmq-server/v{{ rabbitmq_redhat_version }}' |
20 | rabbitmq_redhat_version: '3.6.1' | 20 | rabbitmq_redhat_version: '3.6.1' |
21 | rabbitmq_users: #define admin user to create in order to login to WebUI | 21 | rabbitmq_users: #define admin user to create in order to login to WebUI |
22 | - name: rabbitmqadmin | 22 | - name: 'rabbitmqadmin' |
23 | password: rabbitmqadmin | 23 | password: 'rabbitmqadmin' |
24 | vhost: / | 24 | vhost: '/' |
25 | configure_priv: '.*' | 25 | configure_priv: '.*' |
26 | read_priv: '.*' | 26 | read_priv: '.*' |
27 | write_priv: '.*' | 27 | write_priv: '.*' |
diff --git a/playbook.yml b/playbook.yml index a9a7bba..498c829 100644 --- a/playbook.yml +++ b/playbook.yml | |||
@@ -16,8 +16,8 @@ | |||
16 | - hosts: all | 16 | - hosts: all |
17 | become: true | 17 | become: true |
18 | vars: | 18 | vars: |
19 | - config_rabbitmq_ha: true | 19 | - rabbitmq_config_ha: true |
20 | - enable_rabbitmq_clustering: true | 20 | - rabbitmq_enable_clustering: true |
21 | - pri_domain_name: 'test.vagrant.local' | 21 | - pri_domain_name: 'test.vagrant.local' |
22 | - rabbitmq_master: 'node0' | 22 | - rabbitmq_master: 'node0' |
23 | roles: | 23 | roles: |
diff --git a/tasks/main.yml b/tasks/main.yml index 26abc8d..bd82f93 100644 --- a/tasks/main.yml +++ b/tasks/main.yml | |||
@@ -13,9 +13,9 @@ | |||
13 | register: clustered | 13 | register: clustered |
14 | 14 | ||
15 | - include: rabbitmq_clustering.yml | 15 | - include: rabbitmq_clustering.yml |
16 | when: enable_rabbitmq_clustering and (clustered.stat.exists != True) | 16 | when: rabbitmq_enable_clustering and (clustered.stat.exists != True) |
17 | 17 | ||
18 | - include: rabbitmq_ha_config.yml | 18 | - include: rabbitmq_ha_config.yml |
19 | when: config_rabbitmq_ha and enable_rabbitmq_clustering | 19 | when: rabbitmq_config_ha and rabbitmq_enable_clustering |
20 | 20 | ||
21 | - include: rabbitmq_users.yml | 21 | - include: rabbitmq_users.yml |
diff --git a/tasks/rabbitmq_clustering.yml b/tasks/rabbitmq_clustering.yml index f9b5157..9dece46 100644 --- a/tasks/rabbitmq_clustering.yml +++ b/tasks/rabbitmq_clustering.yml | |||
@@ -12,13 +12,13 @@ | |||
12 | 12 | ||
13 | #- name: grabbing erlang cookie | 13 | #- name: grabbing erlang cookie |
14 | # shell: cat /var/lib/rabbitmq/.erlang.cookie | 14 | # shell: cat /var/lib/rabbitmq/.erlang.cookie |
15 | # register: erlang_cookie | 15 | # register: rabbitmq_erlang_cookie |
16 | # when: inventory_hostname == "{{ rabbitmq_master }}" | 16 | # when: inventory_hostname == "{{ rabbitmq_master }}" |
17 | 17 | ||
18 | - name: rabbitmq_clustering | copy erlang cookie | 18 | - name: rabbitmq_clustering | copy erlang cookie |
19 | template: | 19 | template: |
20 | src: erlang.cookie.j2 | 20 | src: erlang.cookie.j2 |
21 | dest: "{{ erlang_cookie_file }}" | 21 | dest: "{{ rabbitmq_erlang_cookie_file }}" |
22 | owner: rabbitmq | 22 | owner: rabbitmq |
23 | group: rabbitmq | 23 | group: rabbitmq |
24 | mode: 0400 | 24 | mode: 0400 |
diff --git a/tasks/rabbitmq_users.yml b/tasks/rabbitmq_users.yml index 3e1997a..8bce8b2 100644 --- a/tasks/rabbitmq_users.yml +++ b/tasks/rabbitmq_users.yml | |||
@@ -10,7 +10,7 @@ | |||
10 | tags: "{{ item.tags }}" | 10 | tags: "{{ item.tags }}" |
11 | state: present | 11 | state: present |
12 | with_items: "{{ rabbitmq_users }}" | 12 | with_items: "{{ rabbitmq_users }}" |
13 | when: (enable_rabbitmq_clustering is defined and not enable_rabbitmq_clustering) or enable_rabbitmq_clustering is not defined | 13 | when: (rabbitmq_enable_clustering is defined and not rabbitmq_enable_clustering) or rabbitmq_enable_clustering is not defined |
14 | 14 | ||
15 | - name: rabbitmq_users | creating rabbitmq users | 15 | - name: rabbitmq_users | creating rabbitmq users |
16 | rabbitmq_user: | 16 | rabbitmq_user: |
@@ -24,4 +24,4 @@ | |||
24 | state: present | 24 | state: present |
25 | run_once: yes | 25 | run_once: yes |
26 | with_items: "{{ rabbitmq_users }}" | 26 | with_items: "{{ rabbitmq_users }}" |
27 | when: (enable_rabbitmq_clustering is defined and enable_rabbitmq_clustering) | 27 | when: (rabbitmq_enable_clustering is defined and rabbitmq_enable_clustering) |
diff --git a/templates/erlang.cookie.j2 b/templates/erlang.cookie.j2 index cb398e7..edd141f 100644 --- a/templates/erlang.cookie.j2 +++ b/templates/erlang.cookie.j2 | |||
@@ -1 +1 @@ | |||
{{ erlang_cookie }} | {{ rabbitmq_erlang_cookie }} | ||