From da8e343df912e94703a8094f5e62d4c1bcc57345 Mon Sep 17 00:00:00 2001 From: Larry Smith Jr Date: Sat, 3 Dec 2016 16:41:53 -0500 Subject: Addressed issue #5 Signed-off-by: Larry Smith Jr --- README.md | 16 ++++++++-------- defaults/main.yml | 20 ++++++++++---------- playbook.yml | 4 ++-- tasks/main.yml | 4 ++-- tasks/rabbitmq_clustering.yml | 4 ++-- tasks/rabbitmq_users.yml | 4 ++-- templates/erlang.cookie.j2 | 2 +- 7 files changed, 27 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 8685452..03cd1aa 100644 --- a/README.md +++ b/README.md @@ -31,10 +31,10 @@ Role Variables ```` --- # 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 @@ -63,8 +63,8 @@ example... 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 ```` @@ -95,8 +95,8 @@ Example Playbook - 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: 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 @@ --- # 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: '.*' diff --git a/playbook.yml b/playbook.yml index a9a7bba..498c829 100644 --- a/playbook.yml +++ b/playbook.yml @@ -16,8 +16,8 @@ - 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: 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 @@ 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 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 @@ #- 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 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 @@ 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: @@ -24,4 +24,4 @@ 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) 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 }} -- cgit v1.2.3