aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLarry Smith Jr <mrlesmithjr@gmail.com>2018-12-19 09:50:10 -0500
committerLarry Smith Jr <mrlesmithjr@gmail.com>2018-12-20 00:55:34 -0500
commit4353d29ae004cea98d3a80ef941aaa155c84bf9a (patch)
tree964561a22ead9ec868e525ce7f132ecc6d8efaea
parentc760a03786a2247c14129dfd22c0e0fe1357f094 (diff)
downloadansible-rabbitmq-4353d29ae004cea98d3a80ef941aaa155c84bf9a.tar.gz
ansible-rabbitmq-4353d29ae004cea98d3a80ef941aaa155c84bf9a.tar.zst
ansible-rabbitmq-4353d29ae004cea98d3a80ef941aaa155c84bf9a.zip
Cleaned up Vagrant and merged new commits
-rw-r--r--.travis.yml75
l---------Vagrant/roles/ansible-rabbitmq1
-rw-r--r--Vagrant/roles/ansible-rabbitmq/.gitignore3
-rw-r--r--Vagrant/roles/ansible-rabbitmq/.travis.yml29
-rw-r--r--Vagrant/roles/ansible-rabbitmq/README.md123
-rw-r--r--Vagrant/roles/ansible-rabbitmq/Vagrant/Vagrantfile228
-rwxr-xr-xVagrant/roles/ansible-rabbitmq/Vagrant/bootstrap.sh23
-rw-r--r--Vagrant/roles/ansible-rabbitmq/Vagrant/bootstrap.yml180
-rwxr-xr-xVagrant/roles/ansible-rabbitmq/Vagrant/cleanup.sh8
l---------Vagrant/roles/ansible-rabbitmq/Vagrant/playbook.yml1
l---------Vagrant/roles/ansible-rabbitmq/Vagrant/requirements.yml1
-rw-r--r--Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/README.md118
-rw-r--r--Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/Vagrantfile63
-rw-r--r--Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/ansible.cfg3
-rwxr-xr-xVagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/bootstrap.sh14
-rw-r--r--Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/bootstrap.yml152
-rwxr-xr-xVagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/cleanup.sh8
-rw-r--r--Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/defaults/main.yml28
-rw-r--r--Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/handlers/main.yml6
-rw-r--r--Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/meta/main.yml137
-rw-r--r--Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/playbook.yml25
-rw-r--r--Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/requirements.yml2
-rw-r--r--Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/debian.yml35
-rw-r--r--Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/fedora.yml39
-rw-r--r--Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/main.yml21
-rw-r--r--Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_clustering.yml70
-rw-r--r--Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_ha_config.yml44
-rw-r--r--Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_users.yml27
-rw-r--r--Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/redhat.yml40
-rw-r--r--Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/templates/erlang.cookie.j21
-rw-r--r--Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/vars/main.yml2
-rw-r--r--Vagrant/roles/ansible-rabbitmq/ansible.cfg3
-rw-r--r--Vagrant/roles/ansible-rabbitmq/defaults/main.yml28
-rw-r--r--Vagrant/roles/ansible-rabbitmq/handlers/main.yml6
-rw-r--r--Vagrant/roles/ansible-rabbitmq/meta/main.yml137
-rw-r--r--Vagrant/roles/ansible-rabbitmq/playbook.yml25
-rw-r--r--Vagrant/roles/ansible-rabbitmq/requirements.yml2
-rw-r--r--Vagrant/roles/ansible-rabbitmq/tasks/debian.yml35
-rw-r--r--Vagrant/roles/ansible-rabbitmq/tasks/fedora.yml39
-rw-r--r--Vagrant/roles/ansible-rabbitmq/tasks/main.yml21
-rw-r--r--Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_clustering.yml72
-rw-r--r--Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_ha_config.yml44
-rw-r--r--Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_users.yml27
-rw-r--r--Vagrant/roles/ansible-rabbitmq/tasks/redhat.yml40
-rw-r--r--Vagrant/roles/ansible-rabbitmq/templates/erlang.cookie.j21
-rw-r--r--Vagrant/roles/ansible-rabbitmq/tests/inventory1
-rw-r--r--Vagrant/roles/ansible-rabbitmq/tests/test.yml5
-rw-r--r--Vagrant/roles/ansible-rabbitmq/vars/main.yml2
-rw-r--r--defaults/main.yml28
-rw-r--r--meta/main.yml112
-rw-r--r--tasks/debian.yml6
-rw-r--r--tasks/fedora.yml18
-rw-r--r--tasks/rabbitmq_ha_config.yml31
-rw-r--r--tasks/redhat.yml17
-rw-r--r--tests/inventory2
-rw-r--r--tests/test.yml4
56 files changed, 126 insertions, 2087 deletions
diff --git a/.travis.yml b/.travis.yml
index 36bbf62..ef52f88 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,27 +3,68 @@ language: python
3python: "2.7" 3python: "2.7"
4 4
5# Use the new container infrastructure 5# Use the new container infrastructure
6sudo: false 6sudo: required
7 7
8# Install ansible 8services:
9addons: 9 - docker
10 apt:
11 packages:
12 - python-pip
13 10
14install: 11env:
15 # Install ansible 12 - distribution: centos
16 - pip install ansible 13 init: /usr/lib/systemd/systemd
14 version: 7
15 - distribution: fedora
16 init: /usr/lib/systemd/systemd
17 version: 29
18 - distribution: fedora
19 init: /usr/lib/systemd/systemd
20 version: 28
21 - distribution: fedora
22 init: /usr/lib/systemd/systemd
23 version: 27
24 - distribution: fedora
25 init: /usr/lib/systemd/systemd
26 version: 26
27 - distribution: fedora
28 init: /usr/lib/systemd/systemd
29 version: 25
30 - distribution: fedora
31 init: /usr/lib/systemd/systemd
32 version: 24
33 - distribution: ubuntu
34 init: /lib/systemd/systemd
35 version: bionic
36 - distribution: ubuntu
37 init: /lib/systemd/systemd
38 version: xenial
39 - distribution: ubuntu
40 init: /sbin/init
41 version: trusty
42 - distribution: debian
43 init: /lib/systemd/systemd
44 version: stretch
45 - distribution: debian
46 init: /lib/systemd/systemd
47 version: jessie
17 48
18 # Check ansible version 49before_install:
19 - ansible --version 50 - "sudo pip install yamllint"
20 51 - yamllint -c .yamllint.yml .
21 # Create ansible.cfg with correct roles_path 52 - "sudo docker pull ${distribution}:${version}"
22 - printf '[defaults]\nroles_path=../' >ansible.cfg 53 - "sudo docker build --no-cache --rm --file=tests/Dockerfile.${distribution}-${version} --tag=${distribution}-${version}:ansible tests"
23 54
24script: 55script:
25 # Basic role syntax check 56 - container_id=$(mktemp)
26 - ansible-playbook tests/test.yml -i tests/inventory --syntax-check 57 - role_name="ansible-rabbitmq"
58 - 'sudo docker run --detach --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro --volume="${PWD}":/etc/ansible/roles/${role_name}:ro ${distribution}-${version}:ansible ${init} > "${container_id}"'
59 - 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-lint -c /.ansible-lint /etc/ansible/roles/${role_name}/tests/test.yml'
60 - 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/${role_name}/tests/test.yml --syntax-check'
61 - 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/${role_name}/tests/test.yml'
62 - >
63 sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/${role_name}/tests/test.yml
64 | grep -q 'changed=0.*failed=0'
65 && (echo 'Idempotence test: pass' && exit 0)
66 || (echo 'Idempotence test: fail' && exit 1)
67 - 'sudo docker rm -f "$(cat ${container_id})"'
27 68
28notifications: 69notifications:
29 webhooks: https://galaxy.ansible.com/api/v1/notifications/ \ No newline at end of file 70 webhooks: https://galaxy.ansible.com/api/v1/notifications/
diff --git a/Vagrant/roles/ansible-rabbitmq b/Vagrant/roles/ansible-rabbitmq
new file mode 120000
index 0000000..c25bddb
--- /dev/null
+++ b/Vagrant/roles/ansible-rabbitmq
@@ -0,0 +1 @@
../.. \ No newline at end of file
diff --git a/Vagrant/roles/ansible-rabbitmq/.gitignore b/Vagrant/roles/ansible-rabbitmq/.gitignore
deleted file mode 100644
index 409a2e0..0000000
--- a/Vagrant/roles/ansible-rabbitmq/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
1*.retry
2*.vagrant
3.galaxy_install_info
diff --git a/Vagrant/roles/ansible-rabbitmq/.travis.yml b/Vagrant/roles/ansible-rabbitmq/.travis.yml
deleted file mode 100644
index 36bbf62..0000000
--- a/Vagrant/roles/ansible-rabbitmq/.travis.yml
+++ /dev/null
@@ -1,29 +0,0 @@
1---
2language: python
3python: "2.7"
4
5# Use the new container infrastructure
6sudo: false
7
8# Install ansible
9addons:
10 apt:
11 packages:
12 - python-pip
13
14install:
15 # Install ansible
16 - pip install ansible
17
18 # Check ansible version
19 - ansible --version
20
21 # Create ansible.cfg with correct roles_path
22 - printf '[defaults]\nroles_path=../' >ansible.cfg
23
24script:
25 # Basic role syntax check
26 - ansible-playbook tests/test.yml -i tests/inventory --syntax-check
27
28notifications:
29 webhooks: https://galaxy.ansible.com/api/v1/notifications/ \ No newline at end of file
diff --git a/Vagrant/roles/ansible-rabbitmq/README.md b/Vagrant/roles/ansible-rabbitmq/README.md
deleted file mode 100644
index 99c019d..0000000
--- a/Vagrant/roles/ansible-rabbitmq/README.md
+++ /dev/null
@@ -1,123 +0,0 @@
1Role Name
2=========
3
4Installs rabbitmq https://www.rabbitmq.com/ (Configurable...HA and Clustering ready)
5
6Build Status
7------------
8
9[![Build Status](https://travis-ci.org/mrlesmithjr/ansible-rabbitmq.svg?branch=master)](https://travis-ci.org/mrlesmithjr/ansible-rabbitmq)
10
11Requirements
12------------
13
14Ensure hostnames are resolvable prior to clustering...either update /etc/hosts or ensure DNS is working.
15
16Vagrant
17-------
18
19Spin up a 3 node HA Cluster for testing...
20Install Ansible role on your host:
21````
22sudo ansible-galaxy install -r requirements.yml -f
23````
24Now spin up your environment...
25````
26vagrant up
27````
28When you are done testing, tear it all down...
29````
30./cleanup.sh
31````
32
33Role Variables
34--------------
35
36````
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
76Dependencies
77------------
78
79None
80
81Example Playbook
82----------------
83
84````
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
112License
113-------
114
115BSD
116
117Author Information
118------------------
119
120Larry Smith Jr.
121- @mrlesmithjr
122- http://everythingshouldbevirtual.com
123- mrlesmithjr [at] gmail.com
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrant/Vagrantfile b/Vagrant/roles/ansible-rabbitmq/Vagrant/Vagrantfile
deleted file mode 100644
index bca5718..0000000
--- a/Vagrant/roles/ansible-rabbitmq/Vagrant/Vagrantfile
+++ /dev/null
@@ -1,228 +0,0 @@
1# -*- mode: ruby -*-
2# vi: set ft=ruby :
3
4# All Vagrant configuration is done below. The "2" in Vagrant.configure
5# configures the configuration version (we support older styles for
6# backwards compatibility). Please don't change it unless you know what
7# you're doing.
8
9# ---- Define number of nodes to spin up ----
10N = 3
11
12# ---- Define any custom memory/cpu requirement ----
13# if custom requirements are desired...ensure to set
14# custom_cpu_mem == true otherwise set to false
15# By default if custom requirements are defined and set below
16# any node not defined will be configured as the default...
17# which is 1vCPU/512mb...So if setting custom requirements
18# only define any node which requires more than the defaults.
19nodes = [
20 {
21 :node => "node0",
22 :box => "mrlesmithjr/trusty64",
23 :cpu => 1,
24 :mem => 1024
25 }
26]
27
28# ---- Define variables below ----
29#Define if additional disks should be added (true|false)
30additional_disks = false
31additional_disks_controller = "SATA Controller"
32#Define the number of additional disks to add
33additional_disks_num = 1
34#Define disk size in GB
35additional_disks_size = 10
36#Define if additional network adapters should be created (true|false)
37additional_nics = true
38#Define if add'l network adapters are auto configured addresses (true|false)
39additional_nics_auto_config = true
40#Define if additional network adapters should be DHCP assigned (true|false)
41additional_nics_dhcp = false
42#Define the number of additional nics to add
43additional_nics_num = 1
44ansible_groups = {
45 "test-nodes" => ["node[0:#{N-1}]"]
46}
47#Define Vagrant box to load
48box = "ubuntu/trusty64"
49#Define if custom cpu and memory requirements are needed (true|false)
50 #defined within nodes variable above
51custom_cpu_mem = false
52#Define if running desktop OS (true|false)
53desktop = false
54#Define if custom boxes should be used...defined in nodes var..
55enable_custom_boxes = false
56#Define if port forwards should be enabled (true|false)
57enable_port_forwards = false
58#Defines if nodes should be linked from master VM (true|false)
59linked_clones = false
60port_forwards = [
61 {
62 :node => "node0",
63 :guest => 3306,
64 :host => 3306
65 },
66 {
67 :node => "node0",
68 :guest => 80,
69 :host => 8080
70 },
71 {
72 :node => "node0",
73 :guest => 8000,
74 :host => 8000
75 }
76]
77#Define if provisioners should run (true|false)
78provision_nodes = true
79#Define if IP's are random assigned if not DHCP (true|false)
80random_ips = false
81#Define number of CPU cores
82 #will be ignored if custom_cpu_mem == true
83server_cpus = 1
84#Define amount of memory to assign to node(s)
85 #will be ignored if custom_cpu_mem == true
86server_memory = 512
87#Define subnet for private_network (If not using DHCP)
88subnet = "192.168.202."
89#Define starting last octet of the subnet range to begin addresses for node(s)
90subnet_ip_start = 200
91
92Vagrant.configure(2) do |config|
93
94 #Iterate over nodes
95 (1..N).each do |node_id|
96 nid = (node_id - 1)
97
98 config.vm.define "node#{nid}" do |node|
99 if enable_custom_boxes
100 #Initially no so it can be set to yes if found in custom box defined
101 box_set = "no"
102 nodes.each do |cust_box|
103 if cust_box[:node] == "node#{nid}"
104 node.vm.box = cust_box[:box]
105 box_set = "yes"
106 end
107 end
108 if box_set == "no"
109 node.vm.box = box
110 end
111 end
112 if not enable_custom_boxes
113 node.vm.box = box
114 end
115 node.vm.provider "virtualbox" do |vb|
116 if linked_clones
117 vb.linked_clone = true
118 end
119 if not custom_cpu_mem
120 vb.customize ["modifyvm", :id, "--cpus", server_cpus]
121 vb.customize ["modifyvm", :id, "--memory", server_memory]
122 end
123 if custom_cpu_mem
124 nodes.each do |cust_node|
125 if cust_node[:node] == "node#{nid}"
126 vb.customize ["modifyvm", :id, "--cpus", cust_node[:cpu]]
127 vb.customize ["modifyvm", :id, "--memory", cust_node[:mem]]
128 end
129 end
130 end
131
132 # Setup desktop environment
133 if desktop
134 vb.gui = true
135 vb.customize ["modifyvm", :id, "--graphicscontroller", "vboxvga"]
136 vb.customize ["modifyvm", :id, "--accelerate3d", "on"]
137 vb.customize ["modifyvm", :id, "--ioapic", "on"]
138 vb.customize ["modifyvm", :id, "--vram", "128"]
139 vb.customize ["modifyvm", :id, "--hwvirtex", "on"]
140 end
141
142 # Add additional disks
143 if additional_disks
144 (1..additional_disks_num).each do |disk_num|
145 dnum = (disk_num + 1)
146 ddev = ("node#{nid}_Disk#{dnum}.vdi")
147 unless File.exist?("#{ddev}")
148 vb.customize ['createhd', '--filename', ("#{ddev}"), \
149 '--variant', 'Fixed', '--size', additional_disks_size * 1024]
150 end
151 vb.customize ['storageattach', :id, '--storagectl', \
152 "#{additional_disks_controller}", '--port', dnum, '--device', 0, \
153 '--type', 'hdd', '--medium', "node#{nid}_Disk#{dnum}.vdi"]
154 end
155 end
156 end
157 node.vm.hostname = "node#{nid}"
158
159 # Define additional network adapters below
160 if additional_nics
161 if not additional_nics_dhcp
162 (1..additional_nics_num).each do |nic_num|
163 if random_ips
164 nnum = Random.rand(0..50)
165 if additional_nics_auto_config
166 node.vm.network :private_network, \
167 ip: subnet+"#{subnet_ip_start + nid + nnum}"
168 end
169 if not additional_nics_auto_config
170 node.vm.network :private_network, \
171 ip: subnet+"#{subnet_ip_start + nid + nnum}",
172 auto_config: false
173 end
174 end
175 if not random_ips
176 if additional_nics_auto_config
177 node.vm.network :private_network, \
178 ip: subnet+"#{subnet_ip_start + nid}"
179 end
180 if not additional_nics_auto_config
181 node.vm.network :private_network, \
182 ip: subnet+"#{subnet_ip_start + nid}",
183 auto_config: false
184 end
185 end
186 end
187 end
188 if additional_nics_dhcp
189 (1..additional_nics_num).each do |nic_num|
190 node.vm.network :private_network, type: "dhcp"
191 end
192 end
193 end
194
195 # Define port forwards below
196 if enable_port_forwards
197 port_forwards.each do |pf|
198 if pf[:node] == "node#{nid}"
199 node.vm.network :forwarded_port, guest: pf[:guest], \
200 host: pf[:host]
201 end
202 end
203 end
204
205 # Provisioners
206 if provision_nodes
207 if node_id == N
208 node.vm.provision "ansible" do |ansible|
209 ansible.limit = "all"
210 #runs bootstrap Ansible playbook
211 ansible.playbook = "bootstrap.yml"
212 end
213 node.vm.provision "ansible" do |ansible|
214 ansible.limit = "all"
215 #runs Ansible playbook for installing roles/executing tasks
216 ansible.playbook = "playbook.yml"
217 ansible.groups = ansible_groups
218 end
219 end
220 end
221
222 end
223 end
224 if provision_nodes
225 #runs initial shell script
226 config.vm.provision :shell, path: "bootstrap.sh", keep_color: "true"
227 end
228end
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrant/bootstrap.sh b/Vagrant/roles/ansible-rabbitmq/Vagrant/bootstrap.sh
deleted file mode 100755
index 5f1620e..0000000
--- a/Vagrant/roles/ansible-rabbitmq/Vagrant/bootstrap.sh
+++ /dev/null
@@ -1,23 +0,0 @@
1#!/bin/bash
2if [ -f /etc/debian_version ]; then
3 codename="$(lsb_release -c | awk {'print $2}')"
4 if [[ $codename == "vivid" ]]; then
5 sudo apt-get update && \
6 sudo apt-get -y install python-simplejson
7 fi
8 if [[ $codename == "wily" ]]; then
9 sudo apt-get update && \
10 sudo apt-get -y install python-simplejson
11 fi
12 if [[ $codename == "xenial" ]]; then
13 sudo apt-get update && \
14 sudo apt-get -y install python-simplejson
15 fi
16fi
17if [ -f /etc/redhat-release ]; then
18 codename="$(gawk -F= '/^NAME/{print $2}' /etc/os-release)"
19 if [[ $codename == "Fedora" ]]; then
20 sudo dnf -y install python-devel python-dnf && \
21 sudo dnf -y group install "C Development Tools and Libraries"
22 fi
23fi
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrant/bootstrap.yml b/Vagrant/roles/ansible-rabbitmq/Vagrant/bootstrap.yml
deleted file mode 100644
index fbd17cb..0000000
--- a/Vagrant/roles/ansible-rabbitmq/Vagrant/bootstrap.yml
+++ /dev/null
@@ -1,180 +0,0 @@
1---
2- hosts: all
3 remote_user: vagrant
4 become: true
5 vars:
6 - host_vars_directory: './host_vars'
7 - host_vars_file: '{{ host_vars_directory }}/{{ inventory_hostname }}.yml'
8 - pri_domain_name: 'vagrant.local'
9 - ssh_key_path: '.vagrant/machines/{{ inventory_hostname }}/virtualbox/private_key'
10 - update_host_vars: true
11 roles:
12 tasks:
13 - name: updating apt cache (Debian)
14 apt:
15 update_cache: yes
16 cache_valid_time: 3600
17 when: ansible_os_family == "Debian"
18
19 - name: installing ansible pre-reqs (Debian)
20 apt:
21 name: "{{ item }}"
22 state: present
23 with_items:
24 - libffi-dev
25 - libssl-dev
26 - python-dev
27 - python-setuptools
28 when: >
29 ansible_os_family == "Debian"
30
31 - name: installing epel repo (RedHat)
32 yum:
33 name: "epel-release"
34 state: present
35 when: >
36 ansible_os_family == "RedHat" and
37 ansible_distribution != "Fedora"
38
39 - name: installing ansible pre-reqs (RedHat)
40 yum:
41 name: "{{ item }}"
42 state: present
43 with_items:
44 - libffi-devel
45 - openssl-devel
46 - python-crypto
47 - python-devel
48 - python-setuptools
49 when: >
50 ansible_os_family == "RedHat" and
51 ansible_distribution != "Fedora"
52
53 - name: installing ansible pre-reqs (Fedora)
54 dnf:
55 name: "{{ item }}"
56 state: present
57 with_items:
58 - gmp-devel
59 - libffi-devel
60 - openssl-devel
61 - python-crypto
62 - python-devel
63 - python-dnf
64 - python-setuptools
65 - redhat-rpm-config
66 when: >
67 ansible_os_family == "RedHat" and
68 ansible_distribution == "Fedora"
69
70 - name: installing ansible pre-reqs (openSUSE)
71 zypper:
72 name: "{{ item }}"
73 state: present
74 with_items:
75 - gmp-devel
76 - libffi-devel
77 - openssl-devel
78 - python-crypto
79 - python-devel
80 - python-setuptools
81 when: >
82 ansible_os_family == "openSUSE Leap"
83
84 - name: installing python pip
85 easy_install:
86 name: "pip"
87 state: present
88
89 - name: installing ansible
90 pip:
91 name: "ansible"
92 state: present
93 version: 1.9.6
94
95 - name: ensuring host_vars directory exists
96 file:
97 path: "./host_vars"
98 state: directory
99 delegate_to: localhost
100 run_once: true
101 become: false
102 when: update_host_vars is defined and update_host_vars
103
104 - name: ensuring host file exists in host_vars
105 stat:
106 path: "{{ host_vars_file }}"
107 delegate_to: localhost
108 register: host_var
109 become: false
110 when: >
111 update_host_vars is defined and
112 update_host_vars
113
114 - name: creating missing host_vars
115 file:
116 path: "{{ host_vars_file }}"
117 state: touch
118 delegate_to: localhost
119 become: false
120 when: not host_var.stat.exists
121
122 - name: updating ansible_ssh_port
123 lineinfile:
124 dest: "{{ host_vars_file }}"
125 regexp: "^ansible_ssh_port{{ ':' }}"
126 line: "ansible_ssh_port{{ ':' }} 22"
127 delegate_to: localhost
128 become: false
129 when: >
130 (update_host_vars is defined and
131 update_host_vars) and
132 (ansible_eth1 is defined or
133 ansible_enp0s8 is defined)
134
135 - name: updating ansible_ssh_host
136 lineinfile:
137 dest: "{{ host_vars_file }}"
138 regexp: "^ansible_ssh_host{{ ':' }}"
139 line: "ansible_ssh_host{{ ':' }} {{ ansible_eth1.ipv4.address }}"
140 delegate_to: localhost
141 become: false
142 when: >
143 (update_host_vars is defined and
144 update_host_vars) and
145 ansible_eth1 is defined
146
147 - name: updating ansible_ssh_host
148 lineinfile:
149 dest: "{{ host_vars_file }}"
150 regexp: "^ansible_ssh_host{{ ':' }}"
151 line: "ansible_ssh_host{{ ':' }} {{ ansible_enp0s8.ipv4.address }}"
152 delegate_to: localhost
153 become: false
154 when: >
155 (update_host_vars is defined and
156 update_host_vars) and
157 ansible_enp0s8 is defined
158
159 - name: updating ansible_ssh_key
160 lineinfile:
161 dest: "{{ host_vars_file }}"
162 regexp: "^ansible_ssh_private_key_file{{ ':' }}"
163 line: "ansible_ssh_private_key_file{{ ':' }} {{ ssh_key_path }}"
164 delegate_to: localhost
165 become: false
166 when: >
167 update_host_vars is defined and
168 update_host_vars
169
170 - name: ensuring host_vars is yaml formatted
171 lineinfile:
172 dest: "{{ host_vars_file }}"
173 regexp: "---"
174 line: "---"
175 insertbefore: BOF
176 delegate_to: localhost
177 become: false
178 when: >
179 update_host_vars is defined and
180 update_host_vars
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrant/cleanup.sh b/Vagrant/roles/ansible-rabbitmq/Vagrant/cleanup.sh
deleted file mode 100755
index a049429..0000000
--- a/Vagrant/roles/ansible-rabbitmq/Vagrant/cleanup.sh
+++ /dev/null
@@ -1,8 +0,0 @@
1#!/bin/bash
2vagrant destroy -f
3if [ -d host_vars ]; then
4 rm -rf host_vars
5fi
6if [ -d .vagrant ]; then
7 rm -rf .vagrant
8fi
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrant/playbook.yml b/Vagrant/roles/ansible-rabbitmq/Vagrant/playbook.yml
deleted file mode 120000
index 7622583..0000000
--- a/Vagrant/roles/ansible-rabbitmq/Vagrant/playbook.yml
+++ /dev/null
@@ -1 +0,0 @@
1../playbook.yml \ No newline at end of file
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrant/requirements.yml b/Vagrant/roles/ansible-rabbitmq/Vagrant/requirements.yml
deleted file mode 120000
index 6e76d52..0000000
--- a/Vagrant/roles/ansible-rabbitmq/Vagrant/requirements.yml
+++ /dev/null
@@ -1 +0,0 @@
1../requirements.yml \ No newline at end of file
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/README.md b/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/README.md
deleted file mode 100644
index 03cd1aa..0000000
--- a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/README.md
+++ /dev/null
@@ -1,118 +0,0 @@
1Role Name
2=========
3
4Installs rabbitmq https://www.rabbitmq.com/ (Configurable...HA and Clustering ready)
5
6Requirements
7------------
8
9Ensure hostnames are resolvable prior to clustering...either update /etc/hosts or ensure DNS is working.
10
11Vagrant
12-------
13
14Spin up a 3 node HA Cluster for testing...
15Install Ansible role on your host:
16````
17sudo ansible-galaxy install -r requirements.yml -f
18````
19Now spin up your environment...
20````
21vagrant up
22````
23When you are done testing, tear it all down...
24````
25./cleanup.sh
26````
27
28Role Variables
29--------------
30
31````
32---
33# defaults file for ansible-rabbitmq
34rabbitmq_config_ha: false #defines if rabbitmq ha should be configured...define here or in group_vars/group
35rabbitmq_enable_clustering: false #defines if setting up a rabbitmq cluster...define here or in group_vars/group
36rabbitmq_erlang_cookie: 'LSKNKBELKPSTDBBCHETL' #define erlang cookie for cluster...define here or in group_vars/group
37rabbitmq_erlang_cookie_file: '/var/lib/rabbitmq/.erlang.cookie'
38rabbitmq_config:
39 - queue_name: logstash
40 durable: true
41 exchange_name: logstash
42 type: direct
43 routing_key: logstash
44 tags: 'ha-mode=all,ha-sync-mode=automatic'
45rabbitmq_debian_repo: 'deb http://www.rabbitmq.com/debian/ testing main'
46rabbitmq_debian_repo_key: 'http://www.rabbitmq.com/rabbitmq-signing-key-public.asc'
47rabbitmq_master: [] #defines the inventory host that should be considered master...define here or in group_vars/group
48rabbitmq_redhat_repo_key: 'https://www.rabbitmq.com/rabbitmq-signing-key-public.asc'
49rabbitmq_redhat_package: 'rabbitmq-server-{{ rabbitmq_redhat_version }}-1.noarch.rpm'
50rabbitmq_redhat_url: 'http://www.rabbitmq.com/releases/rabbitmq-server/v{{ rabbitmq_redhat_version }}'
51rabbitmq_redhat_version: '3.6.1'
52rabbitmq_users: #define admin user to create in order to login to WebUI
53 - name: rabbitmqadmin
54 password: rabbitmqadmin
55 vhost: /
56 configure_priv: '.*'
57 read_priv: '.*'
58 write_priv: '.*'
59 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
60````
61
62example...
63group_vars/rabbitmq-cluster-nodes
64````
65---
66rabbitmq_enable_clustering: true
67rabbitmq_config_ha: false
68rabbitmq_master: ans-test-1
69````
70
71Dependencies
72------------
73
74None
75
76Example Playbook
77----------------
78
79````
80---
81- hosts: all
82 become: true
83 vars:
84 - pri_domain_name: 'test.vagrant.local'
85 roles:
86 tasks:
87 - name: updating /etc/hosts
88 lineinfile:
89 dest: /etc/hosts
90 regexp: "^{{ hostvars[item].ansible_ssh_host }} {{ item }} {{ item }}.{{ pri_domain_name }}"
91 line: "{{ hostvars[item].ansible_ssh_host }} {{ item }} {{ item }}.{{ pri_domain_name }}"
92 state: present
93 with_items: groups['all']
94
95- hosts: all
96 become: true
97 vars:
98 - rabbitmq_config_ha: true
99 - rabbitmq_enable_clustering: true
100 - pri_domain_name: 'test.vagrant.local'
101 - rabbitmq_master: 'node0'
102 roles:
103 - role: ansible-rabbitmq
104 tasks:
105````
106
107License
108-------
109
110BSD
111
112Author Information
113------------------
114
115Larry Smith Jr.
116- @mrlesmithjr
117- http://everythingshouldbevirtual.com
118- mrlesmithjr [at] gmail.com
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/Vagrantfile b/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/Vagrantfile
deleted file mode 100644
index 9c68a3d..0000000
--- a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/Vagrantfile
+++ /dev/null
@@ -1,63 +0,0 @@
1# -*- mode: ruby -*-
2# vi: set ft=ruby :
3
4# All Vagrant configuration is done below. The "2" in Vagrant.configure
5# configures the configuration version (we support older styles for
6# backwards compatibility). Please don't change it unless you know what
7# you're doing.
8Vagrant.configure(2) do |config|
9 #Define if running desktop OS to yes otherwise no
10 Desktop = "no"
11 #Define the number of nodes to spin up
12 N = 3
13
14 #Iterate over nodes
15 (1..N).each do |node_id|
16 nid = (node_id - 1)
17
18 config.vm.define "node#{nid}" do |node|
19 node.vm.box = "mrlesmithjr/centos-7"
20 node.vm.provider "virtualbox" do |vb|
21 vb.memory = "1024"
22 vb.cpus = "1"
23 if Desktop == "yes"
24 vb.gui = true
25 vb.customize ["modifyvm", :id, "--graphicscontroller", "vboxvga"]
26 vb.customize ["modifyvm", :id, "--accelerate3d", "on"]
27 vb.customize ["modifyvm", :id, "--ioapic", "on"]
28 vb.customize ["modifyvm", :id, "--vram", "128"]
29 vb.customize ["modifyvm", :id, "--hwvirtex", "on"]
30 end
31 end
32 node.vm.hostname = "node#{nid}"
33 ### Define additional network adapters below
34 node.vm.network :private_network, ip: "192.168.202.#{200 + nid}"
35
36 ### Define port forwards below
37# node.vm.network "forwarded_port", guest: 80, host: "#{8080 + nid}"
38# node.vm.network "forwarded_port", guest: 3000, host: "#{3000 + nid}"
39
40 if node_id == N
41 node.vm.provision :shell, path: "bootstrap.sh", keep_color: "true" #runs initial shell script
42 node.vm.provision "ansible" do |ansible| #runs bootstrap Ansible playbook
43 ansible.limit = "all"
44 ansible.playbook = "bootstrap.yml"
45 end
46 node.vm.provision "ansible" do |ansible| #runs Ansible playbook for installing roles/executing tasks
47 ansible.limit = "all"
48 ansible.playbook = "playbook.yml"
49 ansible.groups = {
50 "test-nodes" => [
51 "node0",
52 "node1"
53 ],
54 "prod-nodes" => [
55 "node2"
56 ]
57 }
58 end
59 end
60
61 end
62 end
63end
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/ansible.cfg b/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/ansible.cfg
deleted file mode 100644
index 5a1e589..0000000
--- a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/ansible.cfg
+++ /dev/null
@@ -1,3 +0,0 @@
1[defaults]
2host_key_checking = False
3#roles_path = ../
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/bootstrap.sh b/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/bootstrap.sh
deleted file mode 100755
index 7bcf8b0..0000000
--- a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/bootstrap.sh
+++ /dev/null
@@ -1,14 +0,0 @@
1#!/bin/bash
2if [ -f /etc/debian_version ]; then
3 codename="$(lsb_release -c | awk {'print $2}')"
4 if [ $codename == "vivid" ]; then
5 sudo apt-get update && sudo apt-get -y install python-simplejson
6 fi
7fi
8if [ -f /etc/redhat-release ]; then
9 codename="$(gawk -F= '/^NAME/{print $2}' /etc/os-release)"
10 if [ $codename == "Fedora" ]; then
11 sudo dnf -y install python-devel python-dnf python-pip && \
12 sudo dnf -y group install "C Development Tools and Libraries"
13 fi
14fi
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/bootstrap.yml b/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/bootstrap.yml
deleted file mode 100644
index 702b540..0000000
--- a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/bootstrap.yml
+++ /dev/null
@@ -1,152 +0,0 @@
1---
2- hosts: all
3 remote_user: vagrant
4 become: true
5 vars:
6 - host_vars_directory: './host_vars'
7 - host_vars_file: '{{ host_vars_directory }}/{{ inventory_hostname }}.yml'
8 - pri_domain_name: 'vagrant.local'
9 - ssh_key_path: '.vagrant/machines/{{ inventory_hostname }}/virtualbox/private_key'
10 - update_host_vars: true
11 roles:
12 tasks:
13 - name: updating apt cache (Debian)
14 apt:
15 update_cache: yes
16 cache_valid_time: 3600
17 when: ansible_os_family == "Debian"
18
19 - name: installing ansible pre-reqs (Debian)
20 apt:
21 name: "{{ item }}"
22 state: present
23 with_items:
24 - python-dev
25 - python-pip
26 when: ansible_os_family == "Debian"
27
28 - name: installing epel repo (RedHat)
29 yum:
30 name: "epel-release"
31 state: present
32 when: >
33 ansible_os_family == "RedHat" and
34 ansible_distribution != "Fedora"
35
36 - name: installing ansible pre-reqs (RedHat)
37 yum:
38 name: "{{ item }}"
39 state: present
40 with_items:
41 - python-devel
42 - python-dnf
43 - python-pip
44 when: >
45 ansible_os_family == "RedHat" and
46 ansible_distribution != "Fedora"
47
48 - name: installing ansible pre-reqs (Fedora)
49 dnf:
50 name: "{{ item }}"
51 state: present
52 with_items:
53 - gmp-devel
54 - python-crypto
55 - python-devel
56 - python-dnf
57 - python-pip
58 when: >
59 ansible_os_family == "RedHat" and
60 ansible_distribution == "Fedora"
61
62 - name: installing ansible
63 pip:
64 name: "ansible"
65 state: present
66
67 - name: ensuring host_vars directory exists
68 file:
69 path: "./host_vars"
70 state: directory
71 delegate_to: localhost
72 run_once: true
73 become: false
74 when: update_host_vars is defined and update_host_vars
75
76 - name: ensuring host file exists in host_vars
77 stat:
78 path: "{{ host_vars_file }}"
79 delegate_to: localhost
80 register: host_var
81 become: false
82 when: >
83 update_host_vars is defined and
84 update_host_vars
85
86 - name: creating missing host_vars
87 file:
88 path: "{{ host_vars_file }}"
89 state: touch
90 delegate_to: localhost
91 become: false
92 when: not host_var.stat.exists
93
94 - name: updating ansible_ssh_port
95 lineinfile:
96 dest: "{{ host_vars_file }}"
97 regexp: "^ansible_ssh_port{{ ':' }}"
98 line: "ansible_ssh_port{{ ':' }} 22"
99 delegate_to: localhost
100 become: false
101 when: >
102 (update_host_vars is defined and
103 update_host_vars) and
104 (ansible_eth1 is defined or
105 ansible_enp0s8 is defined)
106
107 - name: updating ansible_ssh_host
108 lineinfile:
109 dest: "{{ host_vars_file }}"
110 regexp: "^ansible_ssh_host{{ ':' }}"
111 line: "ansible_ssh_host{{ ':' }} {{ ansible_eth1.ipv4.address }}"
112 delegate_to: localhost
113 become: false
114 when: >
115 (update_host_vars is defined and
116 update_host_vars) and
117 ansible_eth1 is defined
118
119 - name: updating ansible_ssh_host
120 lineinfile:
121 dest: "{{ host_vars_file }}"
122 regexp: "^ansible_ssh_host{{ ':' }}"
123 line: "ansible_ssh_host{{ ':' }} {{ ansible_enp0s8.ipv4.address }}"
124 delegate_to: localhost
125 become: false
126 when: >
127 (update_host_vars is defined and
128 update_host_vars) and
129 ansible_enp0s8 is defined
130
131 - name: updating ansible_ssh_key
132 lineinfile:
133 dest: "{{ host_vars_file }}"
134 regexp: "^ansible_ssh_private_key_file{{ ':' }}"
135 line: "ansible_ssh_private_key_file{{ ':' }} {{ ssh_key_path }}"
136 delegate_to: localhost
137 become: false
138 when: >
139 update_host_vars is defined and
140 update_host_vars
141
142 - name: ensuring host_vars is yaml formatted
143 lineinfile:
144 dest: "{{ host_vars_file }}"
145 regexp: "---"
146 line: "---"
147 insertbefore: BOF
148 delegate_to: localhost
149 become: false
150 when: >
151 update_host_vars is defined and
152 update_host_vars
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/cleanup.sh b/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/cleanup.sh
deleted file mode 100755
index a049429..0000000
--- a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/cleanup.sh
+++ /dev/null
@@ -1,8 +0,0 @@
1#!/bin/bash
2vagrant destroy -f
3if [ -d host_vars ]; then
4 rm -rf host_vars
5fi
6if [ -d .vagrant ]; then
7 rm -rf .vagrant
8fi
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/defaults/main.yml b/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/defaults/main.yml
deleted file mode 100644
index ad22ead..0000000
--- a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/defaults/main.yml
+++ /dev/null
@@ -1,28 +0,0 @@
1---
2# defaults file for ansible-rabbitmq
3rabbitmq_config:
4 - queue_name: 'logstash'
5 durable: true
6 exchange_name: logstash
7 type: 'direct'
8 routing_key: 'logstash'
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
11rabbitmq_debian_repo: 'deb http://www.rabbitmq.com/debian/ testing main'
12rabbitmq_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
14rabbitmq_erlang_cookie: 'LSKNKBELKPSTDBBCHETL' #define erlang cookie for cluster...define here or in group_vars/group
15rabbitmq_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
17rabbitmq_redhat_repo_key: 'https://www.rabbitmq.com/rabbitmq-signing-key-public.asc'
18rabbitmq_redhat_package: 'rabbitmq-server-{{ rabbitmq_redhat_version }}-1.noarch.rpm'
19rabbitmq_redhat_url: 'http://www.rabbitmq.com/releases/rabbitmq-server/v{{ rabbitmq_redhat_version }}'
20rabbitmq_redhat_version: '3.6.1'
21rabbitmq_users: #define admin user to create in order to login to WebUI
22 - name: 'rabbitmqadmin'
23 password: 'rabbitmqadmin'
24 vhost: '/'
25 configure_priv: '.*'
26 read_priv: '.*'
27 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
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/handlers/main.yml b/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/handlers/main.yml
deleted file mode 100644
index 259ce1c..0000000
--- a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/handlers/main.yml
+++ /dev/null
@@ -1,6 +0,0 @@
1---
2# handlers file for ansible-rabbitmq
3- name: restart rabbitmq-server
4 service:
5 name: "rabbitmq-server"
6 state: restarted
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/meta/main.yml b/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/meta/main.yml
deleted file mode 100644
index b25c818..0000000
--- a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/meta/main.yml
+++ /dev/null
@@ -1,137 +0,0 @@
1---
2galaxy_info:
3 author: Larry Smith Jr.
4 description: Installs rabbitmq https://www.rabbitmq.com/ (Configurable...HA and Clustering ready)
5 #company: your company (optional)
6 # Some suggested licenses:
7 # - BSD (default)
8 # - MIT
9 # - GPLv2
10 # - GPLv3
11 # - Apache
12 # - CC-BY
13 license: license (GPLv2, CC-BY, etc)
14 min_ansible_version: 1.2
15 #
16 # Below are all platforms currently available. Just uncomment
17 # the ones that apply to your role. If you don't see your
18 # platform on this list, let us know and we'll get it added!
19 #
20 platforms:
21 - name: EL
22 versions:
23 # - all
24 # - 5
25 # - 6
26 - 7
27 #- name: GenericUNIX
28 # versions:
29 # - all
30 # - any
31 - name: Fedora
32 versions:
33 # - all
34 # - 16
35 # - 17
36 # - 18
37 # - 19
38 # - 20
39 # - 21
40 - 22
41 - 23
42 #- name: Windows
43 # versions:
44 # - all
45 # - 2012R2
46 #- name: SmartOS
47 # versions:
48 # - all
49 # - any
50 #- name: opensuse
51 # versions:
52 # - all
53 # - 12.1
54 # - 12.2
55 # - 12.3
56 # - 13.1
57 # - 13.2
58 #- name: Amazon
59 # versions:
60 # - all
61 # - 2013.03
62 # - 2013.09
63 #- name: GenericBSD
64 # versions:
65 # - all
66 # - any
67 #- name: FreeBSD
68 # versions:
69 # - all
70 # - 8.0
71 # - 8.1
72 # - 8.2
73 # - 8.3
74 # - 8.4
75 # - 9.0
76 # - 9.1
77 # - 9.1
78 # - 9.2
79 - name: Ubuntu
80 versions:
81 # - all
82 # - lucid
83 # - maverick
84 # - natty
85 # - oneiric
86 # - precise
87 # - quantal
88 # - raring
89 # - saucy
90 - trusty
91 # - utopic
92 # - vivid
93 #- name: SLES
94 # versions:
95 # - all
96 # - 10SP3
97 # - 10SP4
98 # - 11
99 # - 11SP1
100 # - 11SP2
101 # - 11SP3
102 #- name: GenericLinux
103 # versions:
104 # - all
105 # - any
106 #- name: Debian
107 # versions:
108 # - all
109 # - etch
110 # - jessie
111 # - lenny
112 # - squeeze
113 # - wheezy
114 #
115 # Below are all categories currently available. Just as with
116 # the platforms above, uncomment those that apply to your role.
117 #
118 categories:
119 #- cloud
120 #- cloud:ec2
121 #- cloud:gce
122 #- cloud:rax
123 - clustering
124 #- database
125 #- database:nosql
126 #- database:sql
127 #- development
128 #- monitoring
129 #- networking
130 #- packaging
131 - system
132 #- web
133dependencies: []
134 # List your role dependencies here, one per line. Only
135 # dependencies available via galaxy should be listed here.
136 # Be sure to remove the '[]' above if you add dependencies
137 # to this list.
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/playbook.yml b/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/playbook.yml
deleted file mode 100644
index 498c829..0000000
--- a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/playbook.yml
+++ /dev/null
@@ -1,25 +0,0 @@
1---
2- hosts: all
3 become: true
4 vars:
5 - pri_domain_name: 'test.vagrant.local'
6 roles:
7 tasks:
8 - name: updating /etc/hosts
9 lineinfile:
10 dest: /etc/hosts
11 regexp: "^{{ hostvars[item].ansible_ssh_host }} {{ item }} {{ item }}.{{ pri_domain_name }}"
12 line: "{{ hostvars[item].ansible_ssh_host }} {{ item }} {{ item }}.{{ pri_domain_name }}"
13 state: present
14 with_items: groups['all']
15
16- hosts: all
17 become: true
18 vars:
19 - rabbitmq_config_ha: true
20 - rabbitmq_enable_clustering: true
21 - pri_domain_name: 'test.vagrant.local'
22 - rabbitmq_master: 'node0'
23 roles:
24 - role: ansible-rabbitmq
25 tasks:
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/requirements.yml b/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/requirements.yml
deleted file mode 100644
index a1f51cb..0000000
--- a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/requirements.yml
+++ /dev/null
@@ -1,2 +0,0 @@
1---
2- src: https://github.com/mrlesmithjr/ansible-rabbitmq.git
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/debian.yml b/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/debian.yml
deleted file mode 100644
index a031ead..0000000
--- a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/debian.yml
+++ /dev/null
@@ -1,35 +0,0 @@
1---
2- name: debian | adding RabbitMQ public GPG key to the apt repo
3 apt_key:
4 url: "{{ rabbitmq_debian_repo_key }}"
5 state: present
6
7- name: debian | adding RabbitMQ repo
8 apt_repository:
9 repo: "{{ rabbitmq_debian_repo }}"
10 state: present
11 register: "rabbitmq_repo_added"
12
13- name: debian | updating apt cache
14 apt:
15 update_cache: yes
16 when: rabbitmq_repo_added.changed
17
18- name: debian | installing RabbitMQ server
19 apt:
20 name: "{{ item }}"
21 state: present
22 with_items:
23 - rabbitmq-server
24
25- name: debian | enabling the RabbitMQ Management Console
26 rabbitmq_plugin:
27 names: rabbitmq_management
28 state: enabled
29 notify: restart rabbitmq-server
30
31- name: debian | ensuring that the RabbitMQ service is running
32 service:
33 name: rabbitmq-server
34 state: started
35 enabled: yes
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/fedora.yml b/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/fedora.yml
deleted file mode 100644
index 3d92963..0000000
--- a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/fedora.yml
+++ /dev/null
@@ -1,39 +0,0 @@
1---
2- name: fedora | installing pre-reqs
3 dnf:
4 name: "{{ item }}"
5 state: present
6 with_items:
7 - wget
8
9- name: fedora | installing erlang
10 dnf:
11 name: "erlang"
12 state: present
13
14- name: fedora | adding RabbitMQ public GPG key
15 rpm_key:
16 key: "{{ rabbitmq_redhat_repo_key }}"
17 state: present
18
19- name: fedora | downloading RabbitMQ
20 get_url:
21 url: "{{ rabbitmq_redhat_url }}/{{ rabbitmq_redhat_package }}"
22 dest: "/opt/{{ rabbitmq_redhat_package }}"
23
24- name: fedora | installing RabbitMQ
25 dnf:
26 name: "/opt/{{ rabbitmq_redhat_package }}"
27 state: present
28
29- name: fedora | starting and enabling RabbitMQ service
30 service:
31 name: "rabbitmq-server"
32 state: started
33 enabled: yes
34
35- name: fedora | enabling the RabbitMQ Management Console
36 rabbitmq_plugin:
37 names: rabbitmq_management
38 state: enabled
39 notify: restart rabbitmq-server
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/main.yml b/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/main.yml
deleted file mode 100644
index bd82f93..0000000
--- a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/main.yml
+++ /dev/null
@@ -1,21 +0,0 @@
1# tasks file for ansible-rabbitmq
2- include: debian.yml
3 when: ansible_os_family == "Debian"
4
5- include: redhat.yml
6 when: ansible_distribution == "CentOS" or ansible_distribution == "Red Hat Enterprise Linux"
7
8- include: fedora.yml
9 when: ansible_distribution == "Fedora"
10
11- name: checking to see if already clustered
12 stat: path=/etc/rabbitmq/clustered
13 register: clustered
14
15- include: rabbitmq_clustering.yml
16 when: rabbitmq_enable_clustering and (clustered.stat.exists != True)
17
18- include: rabbitmq_ha_config.yml
19 when: rabbitmq_config_ha and rabbitmq_enable_clustering
20
21- include: rabbitmq_users.yml
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_clustering.yml b/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_clustering.yml
deleted file mode 100644
index 9dece46..0000000
--- a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_clustering.yml
+++ /dev/null
@@ -1,70 +0,0 @@
1---
2- name: rabbitmq_clustering | stopping rabbitmq app
3 command: rabbitmqctl stop_app
4
5- name: rabbitmq_clustering | resetting rabbitmq app
6 command: rabbitmqctl reset
7
8- name: rabbitmq_clustering | stopping rabbitmq-server
9 service:
10 name: rabbitmq-server
11 state: stopped
12
13#- name: grabbing erlang cookie
14# shell: cat /var/lib/rabbitmq/.erlang.cookie
15# register: rabbitmq_erlang_cookie
16# when: inventory_hostname == "{{ rabbitmq_master }}"
17
18- name: rabbitmq_clustering | copy erlang cookie
19 template:
20 src: erlang.cookie.j2
21 dest: "{{ rabbitmq_erlang_cookie_file }}"
22 owner: rabbitmq
23 group: rabbitmq
24 mode: 0400
25 backup: yes #backing up in case the need to recover
26# when: inventory_hostname != "{{ rabbitmq_master }}"
27
28- name: rabbitmq_clustering | restarting rabbitmq-server on master
29 service:
30 name: rabbitmq-server
31 state: restarted
32 when: inventory_hostname == "{{ rabbitmq_master }}"
33
34- name: rabbitmq_clustering | starting rabbitmq app on master
35 command: rabbitmqctl start_app
36 register: cluster_master
37 when: inventory_hostname == "{{ rabbitmq_master }}"
38
39- name: rabbitmq_clustering | sending sigterm to any running rabbitmq processes
40 shell: pkill -u rabbitmq || true
41 when: inventory_hostname != "{{ rabbitmq_master }}"
42
43- name: rabbitmq_clustering | restarting rabbitmq-server
44 service:
45 name: rabbitmq-server
46 state: restarted
47 when: inventory_hostname != "{{ rabbitmq_master }}"
48
49- name: rabbitmq_clustering | stopping rabbitmq app
50 command: rabbitmqctl stop_app
51 when: inventory_hostname != "{{ rabbitmq_master }}"
52
53- name: rabbitmq_clustering | resetting rabbitmq app
54 command: rabbitmqctl reset
55 when: inventory_hostname != "{{ rabbitmq_master }}"
56
57- name: rabbitmq_clustering | joining rabbitmq cluster
58 command: rabbitmqctl join_cluster 'rabbit@{{ rabbitmq_master }}'
59 register: cluster_joined
60 when: inventory_hostname != "{{ rabbitmq_master }}"
61
62- name: rabbitmq_clustering | starting rabbitmq app
63 command: rabbitmqctl start_app
64 when: inventory_hostname != "{{ rabbitmq_master }}"
65
66- name: rabbitmq_clustering | marking as clustered
67 file:
68 path: /etc/rabbitmq/clustered
69 state: touch
70 when: cluster_master.changed or cluster_joined.changed
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_ha_config.yml b/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_ha_config.yml
deleted file mode 100644
index 8811b6d..0000000
--- a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_ha_config.yml
+++ /dev/null
@@ -1,44 +0,0 @@
1---
2- name: rabbitmq_ha_config | checking if rabbitmqadmin is installed
3 stat:
4 path: /usr/sbin/rabbitmqadmin
5 register: rabbitmqadmin_check
6
7- name: rabbitmq_ha_config | install rabbitMQ admin
8 shell: wget http://guest:guest@localhost:15672/cli/rabbitmqadmin
9 when: not rabbitmqadmin_check.stat.exists
10
11- name: rabbitmq_ha_config | moving the rabbitMQ Admin
12 shell: mv rabbitmqadmin /usr/sbin
13 when: not rabbitmqadmin_check.stat.exists
14
15- name: rabbitmq_ha_config | making executable rabbitMQ Admin
16 shell: chmod +x /usr/sbin/rabbitmqadmin
17 notify: restart rabbitmq-server
18 when: not rabbitmqadmin_check.stat.exists
19
20- name: rabbitmq_ha_config | creating queue(s)
21 command: rabbitmqadmin declare queue name={{ item.queue_name }} durable={{ item.durable|lower }}
22 run_once: true
23 with_items: "{{ rabbitmq_config }}"
24
25- name: rabbitmq_ha_config | setting up ha on queue(s)
26 rabbitmq_policy:
27 name: "ha-all"
28 pattern: "{{ item.queue_name }}"
29 tags: "{{ item.tags }}"
30 state: present
31 run_once: true
32 with_items: "{{ rabbitmq_config }}"
33
34- name: rabbitmq_ha_config | creating exchange(s)
35 command: rabbitmqadmin declare exchange name={{ item.exchange_name }} type={{ item.type }}
36 run_once: true
37 with_items: "{{ rabbitmq_config }}"
38 when: item.exchange_name is defined
39
40- 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 }}
42 run_once: true
43 with_items: "{{ rabbitmq_config }}"
44 when: item.exchange_name is defined
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_users.yml b/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_users.yml
deleted file mode 100644
index 8bce8b2..0000000
--- a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_users.yml
+++ /dev/null
@@ -1,27 +0,0 @@
1---
2- name: rabbitmq_users | creating rabbitmq users
3 rabbitmq_user:
4 name: "{{ item.name }}"
5 password: "{{ item.password }}"
6 vhost: "{{ item.vhost }}"
7 configure_priv: "{{ item.configure_priv }}"
8 read_priv: "{{ item.read_priv }}"
9 write_priv: "{{ item.write_priv }}"
10 tags: "{{ item.tags }}"
11 state: present
12 with_items: "{{ rabbitmq_users }}"
13 when: (rabbitmq_enable_clustering is defined and not rabbitmq_enable_clustering) or rabbitmq_enable_clustering is not defined
14
15- name: rabbitmq_users | creating rabbitmq users
16 rabbitmq_user:
17 name: "{{ item.name }}"
18 password: "{{ item.password }}"
19 vhost: "{{ item.vhost }}"
20 configure_priv: "{{ item.configure_priv }}"
21 read_priv: "{{ item.read_priv }}"
22 write_priv: "{{ item.write_priv }}"
23 tags: "{{ item.tags }}"
24 state: present
25 run_once: yes
26 with_items: "{{ rabbitmq_users }}"
27 when: (rabbitmq_enable_clustering is defined and rabbitmq_enable_clustering)
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/redhat.yml b/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/redhat.yml
deleted file mode 100644
index 484597d..0000000
--- a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/tasks/redhat.yml
+++ /dev/null
@@ -1,40 +0,0 @@
1---
2- name: redhat | installing pre-reqs
3 yum:
4 name: "{{ item }}"
5 state: present
6 with_items:
7 - epel-release
8 - wget
9
10- name: redhat | installing erlang
11 yum:
12 name: "erlang"
13 state: present
14
15- name: redhat | adding RabbitMQ public GPG key
16 rpm_key:
17 key: "{{ rabbitmq_redhat_repo_key }}"
18 state: present
19
20- name: redhat | downloading RabbitMQ
21 get_url:
22 url: "{{ rabbitmq_redhat_url }}/{{ rabbitmq_redhat_package }}"
23 dest: "/opt/{{ rabbitmq_redhat_package }}"
24
25- name: redhat | installing RabbitMQ
26 yum:
27 name: "/opt/{{ rabbitmq_redhat_package }}"
28 state: present
29
30- name: redhat | starting and enabling RabbitMQ service
31 service:
32 name: "rabbitmq-server"
33 state: started
34 enabled: yes
35
36- name: redhat | enabling the RabbitMQ Management Console
37 rabbitmq_plugin:
38 names: rabbitmq_management
39 state: enabled
40 notify: restart rabbitmq-server
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/templates/erlang.cookie.j2 b/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/templates/erlang.cookie.j2
deleted file mode 100644
index edd141f..0000000
--- a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/templates/erlang.cookie.j2
+++ /dev/null
@@ -1 +0,0 @@
1{{ rabbitmq_erlang_cookie }}
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/vars/main.yml b/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/vars/main.yml
deleted file mode 100644
index 5977bc8..0000000
--- a/Vagrant/roles/ansible-rabbitmq/Vagrant/roles/ansible-rabbitmq/vars/main.yml
+++ /dev/null
@@ -1,2 +0,0 @@
1---
2# vars file for ansible-rabbitmq
diff --git a/Vagrant/roles/ansible-rabbitmq/ansible.cfg b/Vagrant/roles/ansible-rabbitmq/ansible.cfg
deleted file mode 100644
index 5a1e589..0000000
--- a/Vagrant/roles/ansible-rabbitmq/ansible.cfg
+++ /dev/null
@@ -1,3 +0,0 @@
1[defaults]
2host_key_checking = False
3#roles_path = ../
diff --git a/Vagrant/roles/ansible-rabbitmq/defaults/main.yml b/Vagrant/roles/ansible-rabbitmq/defaults/main.yml
deleted file mode 100644
index ad22ead..0000000
--- a/Vagrant/roles/ansible-rabbitmq/defaults/main.yml
+++ /dev/null
@@ -1,28 +0,0 @@
1---
2# defaults file for ansible-rabbitmq
3rabbitmq_config:
4 - queue_name: 'logstash'
5 durable: true
6 exchange_name: logstash
7 type: 'direct'
8 routing_key: 'logstash'
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
11rabbitmq_debian_repo: 'deb http://www.rabbitmq.com/debian/ testing main'
12rabbitmq_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
14rabbitmq_erlang_cookie: 'LSKNKBELKPSTDBBCHETL' #define erlang cookie for cluster...define here or in group_vars/group
15rabbitmq_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
17rabbitmq_redhat_repo_key: 'https://www.rabbitmq.com/rabbitmq-signing-key-public.asc'
18rabbitmq_redhat_package: 'rabbitmq-server-{{ rabbitmq_redhat_version }}-1.noarch.rpm'
19rabbitmq_redhat_url: 'http://www.rabbitmq.com/releases/rabbitmq-server/v{{ rabbitmq_redhat_version }}'
20rabbitmq_redhat_version: '3.6.1'
21rabbitmq_users: #define admin user to create in order to login to WebUI
22 - name: 'rabbitmqadmin'
23 password: 'rabbitmqadmin'
24 vhost: '/'
25 configure_priv: '.*'
26 read_priv: '.*'
27 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
diff --git a/Vagrant/roles/ansible-rabbitmq/handlers/main.yml b/Vagrant/roles/ansible-rabbitmq/handlers/main.yml
deleted file mode 100644
index 259ce1c..0000000
--- a/Vagrant/roles/ansible-rabbitmq/handlers/main.yml
+++ /dev/null
@@ -1,6 +0,0 @@
1---
2# handlers file for ansible-rabbitmq
3- name: restart rabbitmq-server
4 service:
5 name: "rabbitmq-server"
6 state: restarted
diff --git a/Vagrant/roles/ansible-rabbitmq/meta/main.yml b/Vagrant/roles/ansible-rabbitmq/meta/main.yml
deleted file mode 100644
index b25c818..0000000
--- a/Vagrant/roles/ansible-rabbitmq/meta/main.yml
+++ /dev/null
@@ -1,137 +0,0 @@
1---
2galaxy_info:
3 author: Larry Smith Jr.
4 description: Installs rabbitmq https://www.rabbitmq.com/ (Configurable...HA and Clustering ready)
5 #company: your company (optional)
6 # Some suggested licenses:
7 # - BSD (default)
8 # - MIT
9 # - GPLv2
10 # - GPLv3
11 # - Apache
12 # - CC-BY
13 license: license (GPLv2, CC-BY, etc)
14 min_ansible_version: 1.2
15 #
16 # Below are all platforms currently available. Just uncomment
17 # the ones that apply to your role. If you don't see your
18 # platform on this list, let us know and we'll get it added!
19 #
20 platforms:
21 - name: EL
22 versions:
23 # - all
24 # - 5
25 # - 6
26 - 7
27 #- name: GenericUNIX
28 # versions:
29 # - all
30 # - any
31 - name: Fedora
32 versions:
33 # - all
34 # - 16
35 # - 17
36 # - 18
37 # - 19
38 # - 20
39 # - 21
40 - 22
41 - 23
42 #- name: Windows
43 # versions:
44 # - all
45 # - 2012R2
46 #- name: SmartOS
47 # versions:
48 # - all
49 # - any
50 #- name: opensuse
51 # versions:
52 # - all
53 # - 12.1
54 # - 12.2
55 # - 12.3
56 # - 13.1
57 # - 13.2
58 #- name: Amazon
59 # versions:
60 # - all
61 # - 2013.03
62 # - 2013.09
63 #- name: GenericBSD
64 # versions:
65 # - all
66 # - any
67 #- name: FreeBSD
68 # versions:
69 # - all
70 # - 8.0
71 # - 8.1
72 # - 8.2
73 # - 8.3
74 # - 8.4
75 # - 9.0
76 # - 9.1
77 # - 9.1
78 # - 9.2
79 - name: Ubuntu
80 versions:
81 # - all
82 # - lucid
83 # - maverick
84 # - natty
85 # - oneiric
86 # - precise
87 # - quantal
88 # - raring
89 # - saucy
90 - trusty
91 # - utopic
92 # - vivid
93 #- name: SLES
94 # versions:
95 # - all
96 # - 10SP3
97 # - 10SP4
98 # - 11
99 # - 11SP1
100 # - 11SP2
101 # - 11SP3
102 #- name: GenericLinux
103 # versions:
104 # - all
105 # - any
106 #- name: Debian
107 # versions:
108 # - all
109 # - etch
110 # - jessie
111 # - lenny
112 # - squeeze
113 # - wheezy
114 #
115 # Below are all categories currently available. Just as with
116 # the platforms above, uncomment those that apply to your role.
117 #
118 categories:
119 #- cloud
120 #- cloud:ec2
121 #- cloud:gce
122 #- cloud:rax
123 - clustering
124 #- database
125 #- database:nosql
126 #- database:sql
127 #- development
128 #- monitoring
129 #- networking
130 #- packaging
131 - system
132 #- web
133dependencies: []
134 # List your role dependencies here, one per line. Only
135 # dependencies available via galaxy should be listed here.
136 # Be sure to remove the '[]' above if you add dependencies
137 # to this list.
diff --git a/Vagrant/roles/ansible-rabbitmq/playbook.yml b/Vagrant/roles/ansible-rabbitmq/playbook.yml
deleted file mode 100644
index 1968320..0000000
--- a/Vagrant/roles/ansible-rabbitmq/playbook.yml
+++ /dev/null
@@ -1,25 +0,0 @@
1---
2- hosts: all
3 become: true
4 vars:
5 pri_domain_name: 'test.vagrant.local'
6 roles:
7 tasks:
8 - name: updating /etc/hosts
9 lineinfile:
10 dest: /etc/hosts
11 regexp: "^{{ hostvars[item].ansible_ssh_host }} {{ item }} {{ item }}.{{ pri_domain_name }}"
12 line: "{{ hostvars[item].ansible_ssh_host }} {{ item }} {{ item }}.{{ pri_domain_name }}"
13 state: present
14 with_items: "{{ groups['all'] }}"
15
16- hosts: all
17 become: true
18 vars:
19 pri_domain_name: 'test.vagrant.local'
20 rabbitmq_config_ha: true
21 rabbitmq_enable_clustering: true
22 rabbitmq_master: 'node0'
23 roles:
24 - role: ansible-rabbitmq
25 tasks:
diff --git a/Vagrant/roles/ansible-rabbitmq/requirements.yml b/Vagrant/roles/ansible-rabbitmq/requirements.yml
deleted file mode 100644
index a1f51cb..0000000
--- a/Vagrant/roles/ansible-rabbitmq/requirements.yml
+++ /dev/null
@@ -1,2 +0,0 @@
1---
2- src: https://github.com/mrlesmithjr/ansible-rabbitmq.git
diff --git a/Vagrant/roles/ansible-rabbitmq/tasks/debian.yml b/Vagrant/roles/ansible-rabbitmq/tasks/debian.yml
deleted file mode 100644
index a031ead..0000000
--- a/Vagrant/roles/ansible-rabbitmq/tasks/debian.yml
+++ /dev/null
@@ -1,35 +0,0 @@
1---
2- name: debian | adding RabbitMQ public GPG key to the apt repo
3 apt_key:
4 url: "{{ rabbitmq_debian_repo_key }}"
5 state: present
6
7- name: debian | adding RabbitMQ repo
8 apt_repository:
9 repo: "{{ rabbitmq_debian_repo }}"
10 state: present
11 register: "rabbitmq_repo_added"
12
13- name: debian | updating apt cache
14 apt:
15 update_cache: yes
16 when: rabbitmq_repo_added.changed
17
18- name: debian | installing RabbitMQ server
19 apt:
20 name: "{{ item }}"
21 state: present
22 with_items:
23 - rabbitmq-server
24
25- name: debian | enabling the RabbitMQ Management Console
26 rabbitmq_plugin:
27 names: rabbitmq_management
28 state: enabled
29 notify: restart rabbitmq-server
30
31- name: debian | ensuring that the RabbitMQ service is running
32 service:
33 name: rabbitmq-server
34 state: started
35 enabled: yes
diff --git a/Vagrant/roles/ansible-rabbitmq/tasks/fedora.yml b/Vagrant/roles/ansible-rabbitmq/tasks/fedora.yml
deleted file mode 100644
index 3d92963..0000000
--- a/Vagrant/roles/ansible-rabbitmq/tasks/fedora.yml
+++ /dev/null
@@ -1,39 +0,0 @@
1---
2- name: fedora | installing pre-reqs
3 dnf:
4 name: "{{ item }}"
5 state: present
6 with_items:
7 - wget
8
9- name: fedora | installing erlang
10 dnf:
11 name: "erlang"
12 state: present
13
14- name: fedora | adding RabbitMQ public GPG key
15 rpm_key:
16 key: "{{ rabbitmq_redhat_repo_key }}"
17 state: present
18
19- name: fedora | downloading RabbitMQ
20 get_url:
21 url: "{{ rabbitmq_redhat_url }}/{{ rabbitmq_redhat_package }}"
22 dest: "/opt/{{ rabbitmq_redhat_package }}"
23
24- name: fedora | installing RabbitMQ
25 dnf:
26 name: "/opt/{{ rabbitmq_redhat_package }}"
27 state: present
28
29- name: fedora | starting and enabling RabbitMQ service
30 service:
31 name: "rabbitmq-server"
32 state: started
33 enabled: yes
34
35- name: fedora | enabling the RabbitMQ Management Console
36 rabbitmq_plugin:
37 names: rabbitmq_management
38 state: enabled
39 notify: restart rabbitmq-server
diff --git a/Vagrant/roles/ansible-rabbitmq/tasks/main.yml b/Vagrant/roles/ansible-rabbitmq/tasks/main.yml
deleted file mode 100644
index bd82f93..0000000
--- a/Vagrant/roles/ansible-rabbitmq/tasks/main.yml
+++ /dev/null
@@ -1,21 +0,0 @@
1# tasks file for ansible-rabbitmq
2- include: debian.yml
3 when: ansible_os_family == "Debian"
4
5- include: redhat.yml
6 when: ansible_distribution == "CentOS" or ansible_distribution == "Red Hat Enterprise Linux"
7
8- include: fedora.yml
9 when: ansible_distribution == "Fedora"
10
11- name: checking to see if already clustered
12 stat: path=/etc/rabbitmq/clustered
13 register: clustered
14
15- include: rabbitmq_clustering.yml
16 when: rabbitmq_enable_clustering and (clustered.stat.exists != True)
17
18- include: rabbitmq_ha_config.yml
19 when: rabbitmq_config_ha and rabbitmq_enable_clustering
20
21- include: rabbitmq_users.yml
diff --git a/Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_clustering.yml b/Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_clustering.yml
deleted file mode 100644
index 5134c50..0000000
--- a/Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_clustering.yml
+++ /dev/null
@@ -1,72 +0,0 @@
1---
2- name: rabbitmq_clustering | stopping rabbitmq app
3 command: rabbitmqctl stop_app
4 when: inventory_hostname != "{{ rabbitmq_master }}"
5
6- name: rabbitmq_clustering | resetting rabbitmq app
7 command: rabbitmqctl reset
8 when: inventory_hostname != "{{ rabbitmq_master }}"
9
10- name: rabbitmq_clustering | stopping rabbitmq-server
11 service:
12 name: rabbitmq-server
13 state: stopped
14
15#- name: grabbing erlang cookie
16# shell: cat /var/lib/rabbitmq/.erlang.cookie
17# register: rabbitmq_erlang_cookie
18# when: inventory_hostname == "{{ rabbitmq_master }}"
19
20- name: rabbitmq_clustering | copy erlang cookie
21 template:
22 src: erlang.cookie.j2
23 dest: "{{ rabbitmq_erlang_cookie_file }}"
24 owner: rabbitmq
25 group: rabbitmq
26 mode: 0400
27 backup: yes #backing up in case the need to recover
28# when: inventory_hostname != "{{ rabbitmq_master }}"
29
30- name: rabbitmq_clustering | restarting rabbitmq-server on master
31 service:
32 name: rabbitmq-server
33 state: restarted
34 when: inventory_hostname == "{{ rabbitmq_master }}"
35
36- name: rabbitmq_clustering | starting rabbitmq app on master
37 command: rabbitmqctl start_app
38 register: cluster_master
39 when: inventory_hostname == "{{ rabbitmq_master }}"
40
41- name: rabbitmq_clustering | sending sigterm to any running rabbitmq processes
42 shell: pkill -u rabbitmq || true
43 when: inventory_hostname != "{{ rabbitmq_master }}"
44
45- name: rabbitmq_clustering | restarting rabbitmq-server
46 service:
47 name: rabbitmq-server
48 state: restarted
49 when: inventory_hostname != "{{ rabbitmq_master }}"
50
51- name: rabbitmq_clustering | stopping rabbitmq app
52 command: rabbitmqctl stop_app
53 when: inventory_hostname != "{{ rabbitmq_master }}"
54
55- name: rabbitmq_clustering | resetting rabbitmq app
56 command: rabbitmqctl reset
57 when: inventory_hostname != "{{ rabbitmq_master }}"
58
59- name: rabbitmq_clustering | joining rabbitmq cluster
60 command: rabbitmqctl join_cluster "rabbit@{{ hostvars[rabbitmq_master]['ansible_hostname'] }}"
61 register: cluster_joined
62 when: inventory_hostname != "{{ rabbitmq_master }}"
63
64- name: rabbitmq_clustering | starting rabbitmq app
65 command: rabbitmqctl start_app
66 when: inventory_hostname != "{{ rabbitmq_master }}"
67
68- name: rabbitmq_clustering | marking as clustered
69 file:
70 path: /etc/rabbitmq/clustered
71 state: touch
72 when: cluster_master.changed or cluster_joined.changed
diff --git a/Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_ha_config.yml b/Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_ha_config.yml
deleted file mode 100644
index 8811b6d..0000000
--- a/Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_ha_config.yml
+++ /dev/null
@@ -1,44 +0,0 @@
1---
2- name: rabbitmq_ha_config | checking if rabbitmqadmin is installed
3 stat:
4 path: /usr/sbin/rabbitmqadmin
5 register: rabbitmqadmin_check
6
7- name: rabbitmq_ha_config | install rabbitMQ admin
8 shell: wget http://guest:guest@localhost:15672/cli/rabbitmqadmin
9 when: not rabbitmqadmin_check.stat.exists
10
11- name: rabbitmq_ha_config | moving the rabbitMQ Admin
12 shell: mv rabbitmqadmin /usr/sbin
13 when: not rabbitmqadmin_check.stat.exists
14
15- name: rabbitmq_ha_config | making executable rabbitMQ Admin
16 shell: chmod +x /usr/sbin/rabbitmqadmin
17 notify: restart rabbitmq-server
18 when: not rabbitmqadmin_check.stat.exists
19
20- name: rabbitmq_ha_config | creating queue(s)
21 command: rabbitmqadmin declare queue name={{ item.queue_name }} durable={{ item.durable|lower }}
22 run_once: true
23 with_items: "{{ rabbitmq_config }}"
24
25- name: rabbitmq_ha_config | setting up ha on queue(s)
26 rabbitmq_policy:
27 name: "ha-all"
28 pattern: "{{ item.queue_name }}"
29 tags: "{{ item.tags }}"
30 state: present
31 run_once: true
32 with_items: "{{ rabbitmq_config }}"
33
34- name: rabbitmq_ha_config | creating exchange(s)
35 command: rabbitmqadmin declare exchange name={{ item.exchange_name }} type={{ item.type }}
36 run_once: true
37 with_items: "{{ rabbitmq_config }}"
38 when: item.exchange_name is defined
39
40- 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 }}
42 run_once: true
43 with_items: "{{ rabbitmq_config }}"
44 when: item.exchange_name is defined
diff --git a/Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_users.yml b/Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_users.yml
deleted file mode 100644
index 8bce8b2..0000000
--- a/Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_users.yml
+++ /dev/null
@@ -1,27 +0,0 @@
1---
2- name: rabbitmq_users | creating rabbitmq users
3 rabbitmq_user:
4 name: "{{ item.name }}"
5 password: "{{ item.password }}"
6 vhost: "{{ item.vhost }}"
7 configure_priv: "{{ item.configure_priv }}"
8 read_priv: "{{ item.read_priv }}"
9 write_priv: "{{ item.write_priv }}"
10 tags: "{{ item.tags }}"
11 state: present
12 with_items: "{{ rabbitmq_users }}"
13 when: (rabbitmq_enable_clustering is defined and not rabbitmq_enable_clustering) or rabbitmq_enable_clustering is not defined
14
15- name: rabbitmq_users | creating rabbitmq users
16 rabbitmq_user:
17 name: "{{ item.name }}"
18 password: "{{ item.password }}"
19 vhost: "{{ item.vhost }}"
20 configure_priv: "{{ item.configure_priv }}"
21 read_priv: "{{ item.read_priv }}"
22 write_priv: "{{ item.write_priv }}"
23 tags: "{{ item.tags }}"
24 state: present
25 run_once: yes
26 with_items: "{{ rabbitmq_users }}"
27 when: (rabbitmq_enable_clustering is defined and rabbitmq_enable_clustering)
diff --git a/Vagrant/roles/ansible-rabbitmq/tasks/redhat.yml b/Vagrant/roles/ansible-rabbitmq/tasks/redhat.yml
deleted file mode 100644
index 484597d..0000000
--- a/Vagrant/roles/ansible-rabbitmq/tasks/redhat.yml
+++ /dev/null
@@ -1,40 +0,0 @@
1---
2- name: redhat | installing pre-reqs
3 yum:
4 name: "{{ item }}"
5 state: present
6 with_items:
7 - epel-release
8 - wget
9
10- name: redhat | installing erlang
11 yum:
12 name: "erlang"
13 state: present
14
15- name: redhat | adding RabbitMQ public GPG key
16 rpm_key:
17 key: "{{ rabbitmq_redhat_repo_key }}"
18 state: present
19
20- name: redhat | downloading RabbitMQ
21 get_url:
22 url: "{{ rabbitmq_redhat_url }}/{{ rabbitmq_redhat_package }}"
23 dest: "/opt/{{ rabbitmq_redhat_package }}"
24
25- name: redhat | installing RabbitMQ
26 yum:
27 name: "/opt/{{ rabbitmq_redhat_package }}"
28 state: present
29
30- name: redhat | starting and enabling RabbitMQ service
31 service:
32 name: "rabbitmq-server"
33 state: started
34 enabled: yes
35
36- name: redhat | enabling the RabbitMQ Management Console
37 rabbitmq_plugin:
38 names: rabbitmq_management
39 state: enabled
40 notify: restart rabbitmq-server
diff --git a/Vagrant/roles/ansible-rabbitmq/templates/erlang.cookie.j2 b/Vagrant/roles/ansible-rabbitmq/templates/erlang.cookie.j2
deleted file mode 100644
index edd141f..0000000
--- a/Vagrant/roles/ansible-rabbitmq/templates/erlang.cookie.j2
+++ /dev/null
@@ -1 +0,0 @@
1{{ rabbitmq_erlang_cookie }}
diff --git a/Vagrant/roles/ansible-rabbitmq/tests/inventory b/Vagrant/roles/ansible-rabbitmq/tests/inventory
deleted file mode 100644
index d18580b..0000000
--- a/Vagrant/roles/ansible-rabbitmq/tests/inventory
+++ /dev/null
@@ -1 +0,0 @@
1localhost \ No newline at end of file
diff --git a/Vagrant/roles/ansible-rabbitmq/tests/test.yml b/Vagrant/roles/ansible-rabbitmq/tests/test.yml
deleted file mode 100644
index 9b96df5..0000000
--- a/Vagrant/roles/ansible-rabbitmq/tests/test.yml
+++ /dev/null
@@ -1,5 +0,0 @@
1---
2- hosts: localhost
3 remote_user: root
4 roles:
5 - ansible-rabbitmq \ No newline at end of file
diff --git a/Vagrant/roles/ansible-rabbitmq/vars/main.yml b/Vagrant/roles/ansible-rabbitmq/vars/main.yml
deleted file mode 100644
index 5977bc8..0000000
--- a/Vagrant/roles/ansible-rabbitmq/vars/main.yml
+++ /dev/null
@@ -1,2 +0,0 @@
1---
2# vars file for ansible-rabbitmq
diff --git a/defaults/main.yml b/defaults/main.yml
index 4a09ac9..a13fec0 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -1,7 +1,7 @@
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'
@@ -28,11 +28,11 @@ rabbitmq_debian_erlang_from_rabbit: false
28# Defines if setting up a rabbitmq cluster 28# Defines if setting up a rabbitmq cluster
29rabbitmq_enable_clustering: false 29rabbitmq_enable_clustering: false
30 30
31rabbitmq_erlang_cookie_file: '/var/lib/rabbitmq/.erlang.cookie' 31rabbitmq_erlang_cookie_file: /var/lib/rabbitmq/.erlang.cookie
32 32
33rabbitmq_listen_port: 5672 33rabbitmq_listen_port: 5672
34rabbitmq_listeners: [] 34rabbitmq_listeners: []
35 # - '127.0.0.1' 35 # - 127.0.0.1
36 # - '::1' 36 # - '::1'
37 37
38rabbitmq_ssl_enable: false 38rabbitmq_ssl_enable: false
@@ -50,21 +50,21 @@ rabitmq_ssl_options: {}
50# Defines the inventory host that should be considered master 50# Defines the inventory host that should be considered master
51rabbitmq_master: [] 51rabbitmq_master: []
52 52
53rabbitmq_redhat_repo_key: 'https://www.rabbitmq.com/rabbitmq-signing-key-public.asc' 53rabbitmq_redhat_repo_key: https://www.rabbitmq.com/rabbitmq-signing-key-public.asc
54rabbitmq_redhat_package: 'rabbitmq-server-{{ rabbitmq_redhat_version }}-1.noarch.rpm' 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 }}' 55rabbitmq_redhat_url: "http://www.rabbitmq.com/releases/rabbitmq-server/v{{ rabbitmq_redhat_version }}"
56rabbitmq_redhat_version: '3.6.1' 56rabbitmq_redhat_version: 3.6.1
57 57
58# Define admin user to create in order to login to WebUI 58# Define admin user to create in order to login to WebUI
59rabbitmq_users: 59rabbitmq_users:
60 - name: 'rabbitmqadmin' 60 - name: rabbitmqadmin
61 password: 'rabbitmqadmin' 61 password: rabbitmqadmin
62 vhost: '/' 62 vhost: /
63 configure_priv: '.*' 63 configure_priv: ".*"
64 read_priv: '.*' 64 read_priv: ".*"
65 write_priv: '.*' 65 write_priv: ".*"
66 # Define comma separated list of tags to assign to user: 66 # Define comma separated list of tags to assign to user:
67 # management,policymaker,monitoring,administrator 67 # management,policymaker,monitoring,administrator
68 # required for management plugin. 68 # required for management plugin.
69 # https://www.rabbitmq.com/management.html 69 # https://www.rabbitmq.com/management.html
70 tags: 'administrator' 70 tags: administrator
diff --git a/meta/main.yml b/meta/main.yml
index b25c818..84d03bf 100644
--- a/meta/main.yml
+++ b/meta/main.yml
@@ -2,107 +2,19 @@
2galaxy_info: 2galaxy_info:
3 author: Larry Smith Jr. 3 author: Larry Smith Jr.
4 description: Installs rabbitmq https://www.rabbitmq.com/ (Configurable...HA and Clustering ready) 4 description: Installs rabbitmq https://www.rabbitmq.com/ (Configurable...HA and Clustering ready)
5 #company: your company (optional) 5 license: MIT
6 # Some suggested licenses:
7 # - BSD (default)
8 # - MIT
9 # - GPLv2
10 # - GPLv3
11 # - Apache
12 # - CC-BY
13 license: license (GPLv2, CC-BY, etc)
14 min_ansible_version: 1.2 6 min_ansible_version: 1.2
15 #
16 # Below are all platforms currently available. Just uncomment
17 # the ones that apply to your role. If you don't see your
18 # platform on this list, let us know and we'll get it added!
19 #
20 platforms: 7 platforms:
21 - name: EL 8 - name: EL
22 versions: 9 versions:
23 # - all
24 # - 5
25 # - 6
26 - 7 10 - 7
27 #- name: GenericUNIX
28 # versions:
29 # - all
30 # - any
31 - name: Fedora 11 - name: Fedora
32 versions: 12 versions:
33 # - all
34 # - 16
35 # - 17
36 # - 18
37 # - 19
38 # - 20
39 # - 21
40 - 22 13 - 22
41 - 23 14 - 23
42 #- name: Windows
43 # versions:
44 # - all
45 # - 2012R2
46 #- name: SmartOS
47 # versions:
48 # - all
49 # - any
50 #- name: opensuse
51 # versions:
52 # - all
53 # - 12.1
54 # - 12.2
55 # - 12.3
56 # - 13.1
57 # - 13.2
58 #- name: Amazon
59 # versions:
60 # - all
61 # - 2013.03
62 # - 2013.09
63 #- name: GenericBSD
64 # versions:
65 # - all
66 # - any
67 #- name: FreeBSD
68 # versions:
69 # - all
70 # - 8.0
71 # - 8.1
72 # - 8.2
73 # - 8.3
74 # - 8.4
75 # - 9.0
76 # - 9.1
77 # - 9.1
78 # - 9.2
79 - name: Ubuntu 15 - name: Ubuntu
80 versions: 16 versions:
81 # - all
82 # - lucid
83 # - maverick
84 # - natty
85 # - oneiric
86 # - precise
87 # - quantal
88 # - raring
89 # - saucy
90 - trusty 17 - trusty
91 # - utopic
92 # - vivid
93 #- name: SLES
94 # versions:
95 # - all
96 # - 10SP3
97 # - 10SP4
98 # - 11
99 # - 11SP1
100 # - 11SP2
101 # - 11SP3
102 #- name: GenericLinux
103 # versions:
104 # - all
105 # - any
106 #- name: Debian 18 #- name: Debian
107 # versions: 19 # versions:
108 # - all 20 # - all
@@ -111,27 +23,7 @@ galaxy_info:
111 # - lenny 23 # - lenny
112 # - squeeze 24 # - squeeze
113 # - wheezy 25 # - wheezy
114 # 26 galaxy_tags:
115 # Below are all categories currently available. Just as with
116 # the platforms above, uncomment those that apply to your role.
117 #
118 categories:
119 #- cloud
120 #- cloud:ec2
121 #- cloud:gce
122 #- cloud:rax
123 - clustering 27 - clustering
124 #- database
125 #- database:nosql
126 #- database:sql
127 #- development
128 #- monitoring
129 #- networking
130 #- packaging
131 - system 28 - system
132 #- web
133dependencies: [] 29dependencies: []
134 # List your role dependencies here, one per line. Only
135 # dependencies available via galaxy should be listed here.
136 # Be sure to remove the '[]' above if you add dependencies
137 # to this list.
diff --git a/tasks/debian.yml b/tasks/debian.yml
index f35bf55..c98ff68 100644
--- a/tasks/debian.yml
+++ b/tasks/debian.yml
@@ -4,12 +4,16 @@
4 url: "{{ rabbitmq_debian_repo_key }}" 4 url: "{{ rabbitmq_debian_repo_key }}"
5 state: present 5 state: present
6 become: true 6 become: true
7 register: result
8 until: result is successful
7 9
8- name: debian | adding RabbitMQ repo 10- name: debian | adding RabbitMQ repo
9 apt_repository: 11 apt_repository:
10 repo: "{{ rabbitmq_debian_repo }}" 12 repo: "{{ rabbitmq_debian_repo }}"
11 state: present 13 state: present
12 become: true 14 become: true
15 register: result
16 until: result is successful
13 17
14- name: debian | add Rabbitmq erlang repo key 18- name: debian | add Rabbitmq erlang repo key
15 apt_key: 19 apt_key:
@@ -27,7 +31,7 @@
27 31
28- name: debian | installing RabbitMQ server 32- name: debian | installing RabbitMQ server
29 apt: 33 apt:
30 name: "{{ item }}" 34 name: ['rabbitmq-server']
31 state: present 35 state: present
32 become: true 36 become: true
33 with_items: 37 with_items:
diff --git a/tasks/fedora.yml b/tasks/fedora.yml
index 6ac9c03..b09ced0 100644
--- a/tasks/fedora.yml
+++ b/tasks/fedora.yml
@@ -1,23 +1,27 @@
1--- 1---
2- name: fedora | installing pre-reqs 2- name: fedora | installing pre-reqs
3 dnf: 3 dnf:
4 name: "{{ item }}" 4 name: ['wget']
5 state: present 5 state: present
6 become: true 6 become: true
7 with_items: 7 register: result
8 - wget 8 until: result is successful
9 9
10- name: fedora | installing erlang 10- name: fedora | installing erlang
11 dnf: 11 dnf:
12 name: "erlang" 12 name: ['erlang']
13 state: present 13 state: present
14 become: true 14 become: true
15 register: result
16 until: result is successful
15 17
16- name: fedora | adding RabbitMQ public GPG key 18- name: fedora | adding RabbitMQ public GPG key
17 rpm_key: 19 rpm_key:
18 key: "{{ rabbitmq_redhat_repo_key }}" 20 key: "{{ rabbitmq_redhat_repo_key }}"
19 state: present 21 state: present
20 become: true 22 become: true
23 register: result
24 until: result is successful
21 25
22- name: fedora | downloading RabbitMQ 26- name: fedora | downloading RabbitMQ
23 get_url: 27 get_url:
@@ -30,12 +34,14 @@
30 name: "/opt/{{ rabbitmq_redhat_package }}" 34 name: "/opt/{{ rabbitmq_redhat_package }}"
31 state: present 35 state: present
32 become: true 36 become: true
37 register: result
38 until: result is successful
33 39
34- name: fedora | starting and enabling RabbitMQ service 40- name: fedora | starting and enabling RabbitMQ service
35 service: 41 service:
36 name: "rabbitmq-server" 42 name: rabbitmq-server
37 state: started 43 state: started
38 enabled: yes 44 enabled: true
39 become: true 45 become: true
40 46
41- name: fedora | enabling the RabbitMQ Management Console 47- name: fedora | enabling the RabbitMQ Management Console
diff --git a/tasks/rabbitmq_ha_config.yml b/tasks/rabbitmq_ha_config.yml
index 9ebe297..cc31333 100644
--- a/tasks/rabbitmq_ha_config.yml
+++ b/tasks/rabbitmq_ha_config.yml
@@ -4,21 +4,30 @@
4 path: /usr/sbin/rabbitmqadmin 4 path: /usr/sbin/rabbitmqadmin
5 register: rabbitmqadmin_check 5 register: rabbitmqadmin_check
6 6
7- name: rabbitmq_ha_config | install rabbitMQ admin 7- name: rabbit_ha_config | Installing rabbitMQ admin
8 shell: wget http://guest:guest@localhost:15672/cli/rabbitmqadmin 8 get_url:
9 url: http://guest:guest@localhost:15672/cli/rabbitmqadmin
10 dest: /usr/sbin/rabbitmqadmin
11 mode: u=rwx,g=rw,o=rw
9 become: true 12 become: true
13 notify: restart rabbitmq-server
10 when: not rabbitmqadmin_check['stat']['exists'] 14 when: not rabbitmqadmin_check['stat']['exists']
11 15
12- name: rabbitmq_ha_config | moving the rabbitMQ Admin 16# - name: rabbitmq_ha_config | install rabbitMQ admin
13 shell: mv rabbitmqadmin /usr/sbin 17# shell: wget http://guest:guest@localhost:15672/cli/rabbitmqadmin
14 become: true 18# become: true
15 when: not rabbitmqadmin_check['stat']['exists'] 19# when: not rabbitmqadmin_check['stat']['exists']
16 20
17- name: rabbitmq_ha_config | making executable rabbitMQ Admin 21# - name: rabbitmq_ha_config | moving the rabbitMQ Admin
18 shell: chmod +x /usr/sbin/rabbitmqadmin 22# shell: mv rabbitmqadmin /usr/sbin
19 notify: restart rabbitmq-server 23# become: true
20 become: true 24# when: not rabbitmqadmin_check['stat']['exists']
21 when: not rabbitmqadmin_check['stat']['exists'] 25
26# - name: rabbitmq_ha_config | making executable rabbitMQ Admin
27# shell: chmod +x /usr/sbin/rabbitmqadmin
28# notify: restart rabbitmq-server
29# become: true
30# when: not rabbitmqadmin_check['stat']['exists']
22 31
23- name: rabbitmq_ha_config | creating queue(s) 32- name: rabbitmq_ha_config | creating queue(s)
24 command: rabbitmqadmin declare queue name={{ item['queue_name'] }} durable={{ item['durable']|lower }} --vhost={{ item['vhost'] | default('/') }} 33 command: rabbitmqadmin declare queue name={{ item['queue_name'] }} durable={{ item['durable']|lower }} --vhost={{ item['vhost'] | default('/') }}
diff --git a/tasks/redhat.yml b/tasks/redhat.yml
index afa714c..0c7b97a 100644
--- a/tasks/redhat.yml
+++ b/tasks/redhat.yml
@@ -1,24 +1,27 @@
1--- 1---
2- name: redhat | installing pre-reqs 2- name: redhat | installing pre-reqs
3 yum: 3 yum:
4 name: "{{ item }}" 4 name: ['epel-release', 'wget']
5 state: present 5 state: present
6 become: true 6 become: true
7 with_items: 7 register: result
8 - epel-release 8 until: result is successful
9 - wget
10 9
11- name: redhat | installing erlang 10- name: redhat | installing erlang
12 yum: 11 yum:
13 name: "erlang" 12 name: erlang
14 state: present 13 state: present
15 become: true 14 become: true
15 register: result
16 until: result is successful
16 17
17- name: redhat | adding RabbitMQ public GPG key 18- name: redhat | adding RabbitMQ public GPG key
18 rpm_key: 19 rpm_key:
19 key: "{{ rabbitmq_redhat_repo_key }}" 20 key: "{{ rabbitmq_redhat_repo_key }}"
20 state: present 21 state: present
21 become: true 22 become: true
23 register: result
24 until: result is successful
22 25
23- name: redhat | downloading RabbitMQ 26- name: redhat | downloading RabbitMQ
24 get_url: 27 get_url:
@@ -31,10 +34,12 @@
31 name: "/opt/{{ rabbitmq_redhat_package }}" 34 name: "/opt/{{ rabbitmq_redhat_package }}"
32 state: present 35 state: present
33 become: true 36 become: true
37 register: result
38 until: result is successful
34 39
35- name: redhat | starting and enabling RabbitMQ service 40- name: redhat | starting and enabling RabbitMQ service
36 service: 41 service:
37 name: "rabbitmq-server" 42 name: rabbitmq-server
38 state: started 43 state: started
39 enabled: yes 44 enabled: yes
40 become: true 45 become: true
diff --git a/tests/inventory b/tests/inventory
index d18580b..2fbb50c 100644
--- a/tests/inventory
+++ b/tests/inventory
@@ -1 +1 @@
localhost \ No newline at end of file localhost
diff --git a/tests/test.yml b/tests/test.yml
index 9b96df5..0c17bb5 100644
--- a/tests/test.yml
+++ b/tests/test.yml
@@ -1,5 +1,5 @@
1--- 1---
2- hosts: localhost 2- hosts: localhost
3 remote_user: root 3 connection: local
4 roles: 4 roles:
5 - ansible-rabbitmq \ No newline at end of file 5 - ansible-rabbitmq