aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLarry Smith Jr <mrlesmithjr@gmail.com>2017-05-20 21:19:34 -0400
committerLarry Smith Jr <mrlesmithjr@gmail.com>2017-05-20 21:19:34 -0400
commita67dde50f26e0f76d91f0744e8e8341dac95dae2 (patch)
tree2971e931788eddf51b9ec71ac063bfb951215d0c
parentf36f2edd9429200fbd18eeecfbba4b5fe891f26d (diff)
downloadansible-rabbitmq-enhancements/issues-9-10-11.tar.gz
ansible-rabbitmq-enhancements/issues-9-10-11.tar.zst
ansible-rabbitmq-enhancements/issues-9-10-11.zip
Cleaned up code as part of issue #10enhancements/issues-9-10-11
Signed-off-by: Larry Smith Jr <mrlesmithjr@gmail.com>
-rw-r--r--README.md92
-rw-r--r--defaults/main.yml47
-rw-r--r--handlers/main.yml1
-rw-r--r--tasks/debian.yml6
-rw-r--r--tasks/fedora.yml7
-rw-r--r--tasks/main.yml17
-rw-r--r--tasks/rabbitmq_ha_config.yml27
-rw-r--r--tasks/rabbitmq_users.yml39
-rw-r--r--tasks/redhat.yml7
9 files changed, 126 insertions, 117 deletions
diff --git a/README.md b/README.md
index 99c019d..b3b03ad 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
1Role Name 1Role Name
2========= 2=========
3 3
4Installs rabbitmq https://www.rabbitmq.com/ (Configurable...HA and Clustering ready) 4An [Ansible] role to install/configure [RabbitMQ]
5 5
6Build Status 6Build Status
7------------ 7------------
@@ -11,67 +11,30 @@ Build Status
11Requirements 11Requirements
12------------ 12------------
13 13
14Ensure hostnames are resolvable prior to clustering...either update /etc/hosts or ensure DNS is working. 14Ensure hostnames are resolvable prior to clustering...either update /etc/hosts
15or ensure DNS is working.
15 16
16Vagrant 17Vagrant
17------- 18-------
18 19
19Spin up a 3 node HA Cluster for testing... 20Spin up a 3 node HA Cluster for testing...
20Install Ansible role on your host: 21Install Ansible role on your host:
21```` 22```
22sudo ansible-galaxy install -r requirements.yml -f 23sudo ansible-galaxy install -r requirements.yml -f
23```` 24```
24Now spin up your environment... 25Now spin up your environment...
25```` 26```
26vagrant up 27vagrant up
27```` 28```
28When you are done testing, tear it all down... 29When you are done testing, tear it all down...
29```` 30```
30./cleanup.sh 31./cleanup.sh
31```` 32```
32 33
33Role Variables 34Role Variables
34-------------- 35--------------
35 36
36```` 37[Role Defaults](./defaults/main.yml)
37---
38# defaults file for ansible-rabbitmq
39rabbitmq_config_ha: false #defines if rabbitmq ha should be configured...define here or in group_vars/group
40rabbitmq_enable_clustering: false #defines if setting up a rabbitmq cluster...define here or in group_vars/group
41rabbitmq_erlang_cookie: 'LSKNKBELKPSTDBBCHETL' #define erlang cookie for cluster...define here or in group_vars/group
42rabbitmq_erlang_cookie_file: '/var/lib/rabbitmq/.erlang.cookie'
43rabbitmq_config:
44 - queue_name: logstash
45 durable: true
46 exchange_name: logstash
47 type: direct
48 routing_key: logstash
49 tags: 'ha-mode=all,ha-sync-mode=automatic'
50rabbitmq_debian_repo: 'deb http://www.rabbitmq.com/debian/ testing main'
51rabbitmq_debian_repo_key: 'http://www.rabbitmq.com/rabbitmq-signing-key-public.asc'
52rabbitmq_master: [] #defines the inventory host that should be considered master...define here or in group_vars/group
53rabbitmq_redhat_repo_key: 'https://www.rabbitmq.com/rabbitmq-signing-key-public.asc'
54rabbitmq_redhat_package: 'rabbitmq-server-{{ rabbitmq_redhat_version }}-1.noarch.rpm'
55rabbitmq_redhat_url: 'http://www.rabbitmq.com/releases/rabbitmq-server/v{{ rabbitmq_redhat_version }}'
56rabbitmq_redhat_version: '3.6.1'
57rabbitmq_users: #define admin user to create in order to login to WebUI
58 - name: rabbitmqadmin
59 password: rabbitmqadmin
60 vhost: /
61 configure_priv: '.*'
62 read_priv: '.*'
63 write_priv: '.*'
64 tags: 'administrator' #define comma separated list of tags to assign to user....management,policymaker,monitoring,administrator...required for management plugin. https://www.rabbitmq.com/management.html
65````
66
67example...
68group_vars/rabbitmq-cluster-nodes
69````
70---
71rabbitmq_enable_clustering: true
72rabbitmq_config_ha: false
73rabbitmq_master: ans-test-1
74````
75 38
76Dependencies 39Dependencies
77------------ 40------------
@@ -81,33 +44,7 @@ None
81Example Playbook 44Example Playbook
82---------------- 45----------------
83 46
84```` 47[Example Playbook](./playbook.yml)
85---
86- hosts: all
87 become: true
88 vars:
89 - pri_domain_name: 'test.vagrant.local'
90 roles:
91 tasks:
92 - name: updating /etc/hosts
93 lineinfile:
94 dest: /etc/hosts
95 regexp: "^{{ hostvars[item].ansible_ssh_host }} {{ item }} {{ item }}.{{ pri_domain_name }}"
96 line: "{{ hostvars[item].ansible_ssh_host }} {{ item }} {{ item }}.{{ pri_domain_name }}"
97 state: present
98 with_items: "{{ groups['all'] }}"
99
100- hosts: all
101 become: true
102 vars:
103 - rabbitmq_config_ha: true
104 - rabbitmq_enable_clustering: true
105 - pri_domain_name: 'test.vagrant.local'
106 - rabbitmq_master: 'node0'
107 roles:
108 - role: ansible-rabbitmq
109 tasks:
110````
111 48
112License 49License
113------- 50-------
@@ -118,6 +55,11 @@ Author Information
118------------------ 55------------------
119 56
120Larry Smith Jr. 57Larry Smith Jr.
121- @mrlesmithjr 58- [@mrlesmithjr]
122- http://everythingshouldbevirtual.com 59- http://everythingshouldbevirtual.com
123- mrlesmithjr [at] gmail.com 60- mrlesmithjr [at] gmail.com
61
62[@mrlesmithjr]: <https://www.twitter.com/mrlesmithjr>
63
64[Ansible]: <https://www.ansible.com>
65[RabbitMQ]: <https://www.rabbitmq.com/>
diff --git a/defaults/main.yml b/defaults/main.yml
index ad22ead..90d7fb5 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -1,28 +1,49 @@
1--- 1---
2# defaults file for ansible-rabbitmq 2# defaults file for ansible-rabbitmq
3rabbitmq_config: 3rabbitmq_config: []
4 - queue_name: 'logstash' 4 # - queue_name: 'logstash'
5 durable: true 5 # durable: true
6 exchange_name: logstash 6 # exchange_name: logstash
7 type: 'direct' 7 # type: 'direct'
8 routing_key: 'logstash' 8 # routing_key: 'logstash'
9 tags: 'ha-mode=all,ha-sync-mode=automatic' 9 # tags: 'ha-mode=all,ha-sync-mode=automatic'
10rabbitmq_config_ha: false #defines if rabbitmq ha should be configured...define here or in group_vars/group 10
11# Defines if rabbitmq ha should be configured
12rabbitmq_config_ha: false
13
14rabbitmq_config_service: false
15
11rabbitmq_debian_repo: 'deb http://www.rabbitmq.com/debian/ testing main' 16rabbitmq_debian_repo: 'deb http://www.rabbitmq.com/debian/ testing main'
12rabbitmq_debian_repo_key: 'https://www.rabbitmq.com/rabbitmq-release-signing-key.asc' 17rabbitmq_debian_repo_key: 'https://www.rabbitmq.com/rabbitmq-release-signing-key.asc'
13rabbitmq_enable_clustering: false #defines if setting up a rabbitmq cluster...define here or in group_vars/group 18
14rabbitmq_erlang_cookie: 'LSKNKBELKPSTDBBCHETL' #define erlang cookie for cluster...define here or in group_vars/group 19# Defines if setting up a rabbitmq cluster
20rabbitmq_enable_clustering: false
21
15rabbitmq_erlang_cookie_file: '/var/lib/rabbitmq/.erlang.cookie' 22rabbitmq_erlang_cookie_file: '/var/lib/rabbitmq/.erlang.cookie'
16rabbitmq_master: [] #defines the inventory host that should be considered master...define here or in group_vars/group 23
24rabbitmq_listen_port: 5672
25rabbitmq_listeners: []
26 # - '127.0.0.1'
27 # - '::1'
28
29# Defines the inventory host that should be considered master
30rabbitmq_master: []
31
17rabbitmq_redhat_repo_key: 'https://www.rabbitmq.com/rabbitmq-signing-key-public.asc' 32rabbitmq_redhat_repo_key: 'https://www.rabbitmq.com/rabbitmq-signing-key-public.asc'
18rabbitmq_redhat_package: 'rabbitmq-server-{{ rabbitmq_redhat_version }}-1.noarch.rpm' 33rabbitmq_redhat_package: 'rabbitmq-server-{{ rabbitmq_redhat_version }}-1.noarch.rpm'
19rabbitmq_redhat_url: 'http://www.rabbitmq.com/releases/rabbitmq-server/v{{ rabbitmq_redhat_version }}' 34rabbitmq_redhat_url: 'http://www.rabbitmq.com/releases/rabbitmq-server/v{{ rabbitmq_redhat_version }}'
20rabbitmq_redhat_version: '3.6.1' 35rabbitmq_redhat_version: '3.6.1'
21rabbitmq_users: #define admin user to create in order to login to WebUI 36
37# Define admin user to create in order to login to WebUI
38rabbitmq_users:
22 - name: 'rabbitmqadmin' 39 - name: 'rabbitmqadmin'
23 password: 'rabbitmqadmin' 40 password: 'rabbitmqadmin'
24 vhost: '/' 41 vhost: '/'
25 configure_priv: '.*' 42 configure_priv: '.*'
26 read_priv: '.*' 43 read_priv: '.*'
27 write_priv: '.*' 44 write_priv: '.*'
28 tags: 'administrator' #define comma separated list of tags to assign to user....management,policymaker,monitoring,administrator...required for management plugin. https://www.rabbitmq.com/management.html 45 # Define comma separated list of tags to assign to user:
46 # management,policymaker,monitoring,administrator
47 # required for management plugin.
48 # https://www.rabbitmq.com/management.html
49 tags: 'administrator'
diff --git a/handlers/main.yml b/handlers/main.yml
index 259ce1c..4fdafe5 100644
--- a/handlers/main.yml
+++ b/handlers/main.yml
@@ -4,3 +4,4 @@
4 service: 4 service:
5 name: "rabbitmq-server" 5 name: "rabbitmq-server"
6 state: restarted 6 state: restarted
7 become: true
diff --git a/tasks/debian.yml b/tasks/debian.yml
index a031ead..b25d39b 100644
--- a/tasks/debian.yml
+++ b/tasks/debian.yml
@@ -3,22 +3,26 @@
3 apt_key: 3 apt_key:
4 url: "{{ rabbitmq_debian_repo_key }}" 4 url: "{{ rabbitmq_debian_repo_key }}"
5 state: present 5 state: present
6 become: true
6 7
7- name: debian | adding RabbitMQ repo 8- name: debian | adding RabbitMQ repo
8 apt_repository: 9 apt_repository:
9 repo: "{{ rabbitmq_debian_repo }}" 10 repo: "{{ rabbitmq_debian_repo }}"
10 state: present 11 state: present
11 register: "rabbitmq_repo_added" 12 register: "rabbitmq_repo_added"
13 become: true
12 14
13- name: debian | updating apt cache 15- name: debian | updating apt cache
14 apt: 16 apt:
15 update_cache: yes 17 update_cache: yes
18 become: true
16 when: rabbitmq_repo_added.changed 19 when: rabbitmq_repo_added.changed
17 20
18- name: debian | installing RabbitMQ server 21- name: debian | installing RabbitMQ server
19 apt: 22 apt:
20 name: "{{ item }}" 23 name: "{{ item }}"
21 state: present 24 state: present
25 become: true
22 with_items: 26 with_items:
23 - rabbitmq-server 27 - rabbitmq-server
24 28
@@ -26,6 +30,7 @@
26 rabbitmq_plugin: 30 rabbitmq_plugin:
27 names: rabbitmq_management 31 names: rabbitmq_management
28 state: enabled 32 state: enabled
33 become: true
29 notify: restart rabbitmq-server 34 notify: restart rabbitmq-server
30 35
31- name: debian | ensuring that the RabbitMQ service is running 36- name: debian | ensuring that the RabbitMQ service is running
@@ -33,3 +38,4 @@
33 name: rabbitmq-server 38 name: rabbitmq-server
34 state: started 39 state: started
35 enabled: yes 40 enabled: yes
41 become: true
diff --git a/tasks/fedora.yml b/tasks/fedora.yml
index 3d92963..6ac9c03 100644
--- a/tasks/fedora.yml
+++ b/tasks/fedora.yml
@@ -3,6 +3,7 @@
3 dnf: 3 dnf:
4 name: "{{ item }}" 4 name: "{{ item }}"
5 state: present 5 state: present
6 become: true
6 with_items: 7 with_items:
7 - wget 8 - wget
8 9
@@ -10,30 +11,36 @@
10 dnf: 11 dnf:
11 name: "erlang" 12 name: "erlang"
12 state: present 13 state: present
14 become: true
13 15
14- name: fedora | adding RabbitMQ public GPG key 16- name: fedora | adding RabbitMQ public GPG key
15 rpm_key: 17 rpm_key:
16 key: "{{ rabbitmq_redhat_repo_key }}" 18 key: "{{ rabbitmq_redhat_repo_key }}"
17 state: present 19 state: present
20 become: true
18 21
19- name: fedora | downloading RabbitMQ 22- name: fedora | downloading RabbitMQ
20 get_url: 23 get_url:
21 url: "{{ rabbitmq_redhat_url }}/{{ rabbitmq_redhat_package }}" 24 url: "{{ rabbitmq_redhat_url }}/{{ rabbitmq_redhat_package }}"
22 dest: "/opt/{{ rabbitmq_redhat_package }}" 25 dest: "/opt/{{ rabbitmq_redhat_package }}"
26 become: true
23 27
24- name: fedora | installing RabbitMQ 28- name: fedora | installing RabbitMQ
25 dnf: 29 dnf:
26 name: "/opt/{{ rabbitmq_redhat_package }}" 30 name: "/opt/{{ rabbitmq_redhat_package }}"
27 state: present 31 state: present
32 become: true
28 33
29- name: fedora | starting and enabling RabbitMQ service 34- name: fedora | starting and enabling RabbitMQ service
30 service: 35 service:
31 name: "rabbitmq-server" 36 name: "rabbitmq-server"
32 state: started 37 state: started
33 enabled: yes 38 enabled: yes
39 become: true
34 40
35- name: fedora | enabling the RabbitMQ Management Console 41- name: fedora | enabling the RabbitMQ Management Console
36 rabbitmq_plugin: 42 rabbitmq_plugin:
37 names: rabbitmq_management 43 names: rabbitmq_management
38 state: enabled 44 state: enabled
39 notify: restart rabbitmq-server 45 notify: restart rabbitmq-server
46 become: true
diff --git a/tasks/main.yml b/tasks/main.yml
index bd82f93..1da06c4 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -3,19 +3,30 @@
3 when: ansible_os_family == "Debian" 3 when: ansible_os_family == "Debian"
4 4
5- include: redhat.yml 5- include: redhat.yml
6 when: ansible_distribution == "CentOS" or ansible_distribution == "Red Hat Enterprise Linux" 6 when: >
7 ansible_distribution == "CentOS" or
8 ansible_distribution == "Red Hat Enterprise Linux"
7 9
8- include: fedora.yml 10- include: fedora.yml
9 when: ansible_distribution == "Fedora" 11 when: ansible_distribution == "Fedora"
10 12
13- include: config.yml
14 when: rabbitmq_config_service
15
11- name: checking to see if already clustered 16- name: checking to see if already clustered
12 stat: path=/etc/rabbitmq/clustered 17 stat: path=/etc/rabbitmq/clustered
13 register: clustered 18 register: clustered
14 19
15- include: rabbitmq_clustering.yml 20- include: rabbitmq_clustering.yml
16 when: rabbitmq_enable_clustering and (clustered.stat.exists != True) 21 when: >
22 rabbitmq_enable_clustering and
23 not clustered['stat']['exists']
17 24
18- include: rabbitmq_ha_config.yml 25- include: rabbitmq_ha_config.yml
19 when: rabbitmq_config_ha and rabbitmq_enable_clustering 26 when: >
27 rabbitmq_config_ha and
28 rabbitmq_enable_clustering and
29 rabbitmq_config is defined
20 30
21- include: rabbitmq_users.yml 31- include: rabbitmq_users.yml
32 when: rabbitmq_users is defined
diff --git a/tasks/rabbitmq_ha_config.yml b/tasks/rabbitmq_ha_config.yml
index 8811b6d..bf74957 100644
--- a/tasks/rabbitmq_ha_config.yml
+++ b/tasks/rabbitmq_ha_config.yml
@@ -6,39 +6,46 @@
6 6
7- name: rabbitmq_ha_config | install rabbitMQ admin 7- name: rabbitmq_ha_config | install rabbitMQ admin
8 shell: wget http://guest:guest@localhost:15672/cli/rabbitmqadmin 8 shell: wget http://guest:guest@localhost:15672/cli/rabbitmqadmin
9 when: not rabbitmqadmin_check.stat.exists 9 become: true
10 when: not rabbitmqadmin_check['stat']['exists']
10 11
11- name: rabbitmq_ha_config | moving the rabbitMQ Admin 12- name: rabbitmq_ha_config | moving the rabbitMQ Admin
12 shell: mv rabbitmqadmin /usr/sbin 13 shell: mv rabbitmqadmin /usr/sbin
13 when: not rabbitmqadmin_check.stat.exists 14 become: true
15 when: not rabbitmqadmin_check['stat']['exists']
14 16
15- name: rabbitmq_ha_config | making executable rabbitMQ Admin 17- name: rabbitmq_ha_config | making executable rabbitMQ Admin
16 shell: chmod +x /usr/sbin/rabbitmqadmin 18 shell: chmod +x /usr/sbin/rabbitmqadmin
17 notify: restart rabbitmq-server 19 notify: restart rabbitmq-server
18 when: not rabbitmqadmin_check.stat.exists 20 become: true
21 when: not rabbitmqadmin_check['stat']['exists']
19 22
20- name: rabbitmq_ha_config | creating queue(s) 23- name: rabbitmq_ha_config | creating queue(s)
21 command: rabbitmqadmin declare queue name={{ item.queue_name }} durable={{ item.durable|lower }} 24 command: rabbitmqadmin declare queue name={{ item['queue_name'] }} durable={{ item['durable']|lower }}
22 run_once: true 25 run_once: true
26 become: true
23 with_items: "{{ rabbitmq_config }}" 27 with_items: "{{ rabbitmq_config }}"
24 28
25- name: rabbitmq_ha_config | setting up ha on queue(s) 29- name: rabbitmq_ha_config | setting up ha on queue(s)
26 rabbitmq_policy: 30 rabbitmq_policy:
27 name: "ha-all" 31 name: "ha-all"
28 pattern: "{{ item.queue_name }}" 32 pattern: "{{ item['queue_name'] }}"
29 tags: "{{ item.tags }}" 33 tags: "{{ item['tags'] }}"
30 state: present 34 state: present
31 run_once: true 35 run_once: true
36 become: true
32 with_items: "{{ rabbitmq_config }}" 37 with_items: "{{ rabbitmq_config }}"
33 38
34- name: rabbitmq_ha_config | creating exchange(s) 39- name: rabbitmq_ha_config | creating exchange(s)
35 command: rabbitmqadmin declare exchange name={{ item.exchange_name }} type={{ item.type }} 40 command: rabbitmqadmin declare exchange name={{ item['exchange_name'] }} type={{ item['type'] }}
36 run_once: true 41 run_once: true
42 become: true
37 with_items: "{{ rabbitmq_config }}" 43 with_items: "{{ rabbitmq_config }}"
38 when: item.exchange_name is defined 44 when: item['exchange_name'] is defined
39 45
40- name: rabbitmq_ha_config | creating binding(s) 46- name: rabbitmq_ha_config | creating binding(s)
41 command: rabbitmqadmin declare binding source={{ item.exchange_name }} destination_type="queue" destination={{ item.queue_name }} routing_key={{ item.routing_key }} 47 command: rabbitmqadmin declare binding source={{ item['exchange_name'] }} destination_type="queue" destination={{ item['queue_name'] }} routing_key={{ item['routing_key'] }}
42 run_once: true 48 run_once: true
49 become: true
43 with_items: "{{ rabbitmq_config }}" 50 with_items: "{{ rabbitmq_config }}"
44 when: item.exchange_name is defined 51 when: item['exchange_name'] is defined
diff --git a/tasks/rabbitmq_users.yml b/tasks/rabbitmq_users.yml
index 8bce8b2..98e45e2 100644
--- a/tasks/rabbitmq_users.yml
+++ b/tasks/rabbitmq_users.yml
@@ -1,27 +1,34 @@
1--- 1---
2- name: rabbitmq_users | creating rabbitmq users 2- name: rabbitmq_users | creating rabbitmq users
3 rabbitmq_user: 3 rabbitmq_user:
4 name: "{{ item.name }}" 4 name: "{{ item['name'] }}"
5 password: "{{ item.password }}" 5 password: "{{ item['password'] }}"
6 vhost: "{{ item.vhost }}" 6 vhost: "{{ item['vhost'] }}"
7 configure_priv: "{{ item.configure_priv }}" 7 configure_priv: "{{ item['configure_priv'] }}"
8 read_priv: "{{ item.read_priv }}" 8 read_priv: "{{ item['read_priv'] }}"
9 write_priv: "{{ item.write_priv }}" 9 write_priv: "{{ item['write_priv'] }}"
10 tags: "{{ item.tags }}" 10 tags: "{{ item['tags'] }}"
11 state: present 11 state: present
12 become: true
12 with_items: "{{ rabbitmq_users }}" 13 with_items: "{{ rabbitmq_users }}"
13 when: (rabbitmq_enable_clustering is defined and not rabbitmq_enable_clustering) or rabbitmq_enable_clustering is not defined 14 when: >
15 (rabbitmq_enable_clustering is defined and
16 not rabbitmq_enable_clustering) or
17 rabbitmq_enable_clustering is not defined
14 18
15- name: rabbitmq_users | creating rabbitmq users 19- name: rabbitmq_users | creating rabbitmq users
16 rabbitmq_user: 20 rabbitmq_user:
17 name: "{{ item.name }}" 21 name: "{{ item['name'] }}"
18 password: "{{ item.password }}" 22 password: "{{ item['password'] }}"
19 vhost: "{{ item.vhost }}" 23 vhost: "{{ item['vhost'] }}"
20 configure_priv: "{{ item.configure_priv }}" 24 configure_priv: "{{ item['configure_priv'] }}"
21 read_priv: "{{ item.read_priv }}" 25 read_priv: "{{ item['read_priv'] }}"
22 write_priv: "{{ item.write_priv }}" 26 write_priv: "{{ item['write_priv'] }}"
23 tags: "{{ item.tags }}" 27 tags: "{{ item['tags'] }}"
24 state: present 28 state: present
25 run_once: yes 29 run_once: yes
30 become: true
26 with_items: "{{ rabbitmq_users }}" 31 with_items: "{{ rabbitmq_users }}"
27 when: (rabbitmq_enable_clustering is defined and rabbitmq_enable_clustering) 32 when: >
33 rabbitmq_enable_clustering is defined and
34 rabbitmq_enable_clustering
diff --git a/tasks/redhat.yml b/tasks/redhat.yml
index 484597d..afa714c 100644
--- a/tasks/redhat.yml
+++ b/tasks/redhat.yml
@@ -3,6 +3,7 @@
3 yum: 3 yum:
4 name: "{{ item }}" 4 name: "{{ item }}"
5 state: present 5 state: present
6 become: true
6 with_items: 7 with_items:
7 - epel-release 8 - epel-release
8 - wget 9 - wget
@@ -11,30 +12,36 @@
11 yum: 12 yum:
12 name: "erlang" 13 name: "erlang"
13 state: present 14 state: present
15 become: true
14 16
15- name: redhat | adding RabbitMQ public GPG key 17- name: redhat | adding RabbitMQ public GPG key
16 rpm_key: 18 rpm_key:
17 key: "{{ rabbitmq_redhat_repo_key }}" 19 key: "{{ rabbitmq_redhat_repo_key }}"
18 state: present 20 state: present
21 become: true
19 22
20- name: redhat | downloading RabbitMQ 23- name: redhat | downloading RabbitMQ
21 get_url: 24 get_url:
22 url: "{{ rabbitmq_redhat_url }}/{{ rabbitmq_redhat_package }}" 25 url: "{{ rabbitmq_redhat_url }}/{{ rabbitmq_redhat_package }}"
23 dest: "/opt/{{ rabbitmq_redhat_package }}" 26 dest: "/opt/{{ rabbitmq_redhat_package }}"
27 become: true
24 28
25- name: redhat | installing RabbitMQ 29- name: redhat | installing RabbitMQ
26 yum: 30 yum:
27 name: "/opt/{{ rabbitmq_redhat_package }}" 31 name: "/opt/{{ rabbitmq_redhat_package }}"
28 state: present 32 state: present
33 become: true
29 34
30- name: redhat | starting and enabling RabbitMQ service 35- name: redhat | starting and enabling RabbitMQ service
31 service: 36 service:
32 name: "rabbitmq-server" 37 name: "rabbitmq-server"
33 state: started 38 state: started
34 enabled: yes 39 enabled: yes
40 become: true
35 41
36- name: redhat | enabling the RabbitMQ Management Console 42- name: redhat | enabling the RabbitMQ Management Console
37 rabbitmq_plugin: 43 rabbitmq_plugin:
38 names: rabbitmq_management 44 names: rabbitmq_management
39 state: enabled 45 state: enabled
40 notify: restart rabbitmq-server 46 notify: restart rabbitmq-server
47 become: true