diff options
-rw-r--r-- | README.md | 69 | ||||
-rw-r--r-- | Vagrantfile | 63 | ||||
-rw-r--r-- | ansible.cfg | 3 | ||||
-rwxr-xr-x | bootstrap.sh | 14 | ||||
-rw-r--r-- | bootstrap.yml | 152 | ||||
-rwxr-xr-x | cleanup.sh | 8 | ||||
-rw-r--r-- | defaults/main.yml | 12 | ||||
-rw-r--r-- | handlers/main.yml | 4 | ||||
-rw-r--r-- | meta/main.yml | 6 | ||||
-rw-r--r-- | playbook.yml | 25 | ||||
-rw-r--r-- | requirements.yml | 2 | ||||
-rw-r--r-- | tasks/main.yml | 3 | ||||
-rw-r--r-- | tasks/redhat.yml | 43 |
13 files changed, 389 insertions, 15 deletions
@@ -8,14 +8,33 @@ Requirements | |||
8 | 8 | ||
9 | Ensure hostnames are resolvable prior to clustering...either update /etc/hosts or ensure DNS is working. | 9 | Ensure hostnames are resolvable prior to clustering...either update /etc/hosts or ensure DNS is working. |
10 | 10 | ||
11 | Vagrant | ||
12 | ------- | ||
13 | |||
14 | Spin up a 3 node HA Cluster for testing... | ||
15 | Install Ansible role on your host: | ||
16 | ```` | ||
17 | sudo ansible-galaxy install -r requirements.yml -f | ||
18 | ```` | ||
19 | Now spin up your environment... | ||
20 | ```` | ||
21 | vagrant up | ||
22 | ```` | ||
23 | When you are done testing, tear it all down... | ||
24 | ```` | ||
25 | ./cleanup.sh | ||
26 | ```` | ||
27 | |||
11 | Role Variables | 28 | Role Variables |
12 | -------------- | 29 | -------------- |
13 | 30 | ||
14 | ```` | 31 | ```` |
32 | --- | ||
33 | # defaults file for ansible-rabbitmq | ||
15 | config_rabbitmq_ha: false #defines if rabbitmq ha should be configured...define here or in group_vars/group | 34 | config_rabbitmq_ha: false #defines if rabbitmq ha should be configured...define here or in group_vars/group |
16 | enable_rabbitmq_clustering: false #defines if setting up a rabbitmq cluster...define here or in group_vars/group | 35 | enable_rabbitmq_clustering: false #defines if setting up a rabbitmq cluster...define here or in group_vars/group |
17 | erlang_cookie: LSKNKBELKPSTDBBCHETL #define erlang cookie for cluster...define here or in group_vars/group | 36 | erlang_cookie: 'LSKNKBELKPSTDBBCHETL' #define erlang cookie for cluster...define here or in group_vars/group |
18 | erlang_cookie_file: /var/lib/rabbitmq/.erlang.cookie | 37 | erlang_cookie_file: '/var/lib/rabbitmq/.erlang.cookie' |
19 | rabbitmq_config: | 38 | rabbitmq_config: |
20 | - queue_name: logstash | 39 | - queue_name: logstash |
21 | durable: true | 40 | durable: true |
@@ -23,7 +42,21 @@ rabbitmq_config: | |||
23 | type: direct | 42 | type: direct |
24 | routing_key: logstash | 43 | routing_key: logstash |
25 | tags: 'ha-mode=all,ha-sync-mode=automatic' | 44 | tags: 'ha-mode=all,ha-sync-mode=automatic' |
45 | rabbitmq_debian_repo: 'deb http://www.rabbitmq.com/debian/ testing main' | ||
46 | rabbitmq_debian_repo_key: 'http://www.rabbitmq.com/rabbitmq-signing-key-public.asc' | ||
26 | rabbitmq_master: [] #defines the inventory host that should be considered master...define here or in group_vars/group | 47 | rabbitmq_master: [] #defines the inventory host that should be considered master...define here or in group_vars/group |
48 | rabbitmq_redhat_repo_key: 'https://www.rabbitmq.com/rabbitmq-signing-key-public.asc' | ||
49 | rabbitmq_redhat_package: 'rabbitmq-server-{{ rabbitmq_redhat_version }}-1.noarch.rpm' | ||
50 | rabbitmq_redhat_url: 'http://www.rabbitmq.com/releases/rabbitmq-server/v{{ rabbitmq_redhat_version }}' | ||
51 | rabbitmq_redhat_version: '3.6.1' | ||
52 | rabbitmq_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 | ||
27 | ```` | 60 | ```` |
28 | 61 | ||
29 | example... | 62 | example... |
@@ -38,16 +71,38 @@ rabbitmq_master: ans-test-1 | |||
38 | Dependencies | 71 | Dependencies |
39 | ------------ | 72 | ------------ |
40 | 73 | ||
41 | A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. | 74 | None |
42 | 75 | ||
43 | Example Playbook | 76 | Example Playbook |
44 | ---------------- | 77 | ---------------- |
45 | 78 | ||
46 | Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: | 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'] | ||
47 | 94 | ||
48 | - hosts: servers | 95 | - hosts: all |
49 | roles: | 96 | become: true |
50 | - { role: mrlesmithjr.rabbitmq } | 97 | vars: |
98 | - config_rabbitmq_ha: true | ||
99 | - enable_rabbitmq_clustering: true | ||
100 | - pri_domain_name: 'test.vagrant.local' | ||
101 | - rabbitmq_master: 'node0' | ||
102 | roles: | ||
103 | - role: ansible-rabbitmq | ||
104 | tasks: | ||
105 | ```` | ||
51 | 106 | ||
52 | License | 107 | License |
53 | ------- | 108 | ------- |
diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..9c68a3d --- /dev/null +++ b/Vagrantfile | |||
@@ -0,0 +1,63 @@ | |||
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 | Vagrant.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 | ||
63 | end | ||
diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 0000000..5a1e589 --- /dev/null +++ b/ansible.cfg | |||
@@ -0,0 +1,3 @@ | |||
1 | [defaults] | ||
2 | host_key_checking = False | ||
3 | #roles_path = ../ | ||
diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100755 index 0000000..7bcf8b0 --- /dev/null +++ b/bootstrap.sh | |||
@@ -0,0 +1,14 @@ | |||
1 | #!/bin/bash | ||
2 | if [ -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 | ||
7 | fi | ||
8 | if [ -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 | ||
14 | fi | ||
diff --git a/bootstrap.yml b/bootstrap.yml new file mode 100644 index 0000000..702b540 --- /dev/null +++ b/bootstrap.yml | |||
@@ -0,0 +1,152 @@ | |||
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/cleanup.sh b/cleanup.sh new file mode 100755 index 0000000..a049429 --- /dev/null +++ b/cleanup.sh | |||
@@ -0,0 +1,8 @@ | |||
1 | #!/bin/bash | ||
2 | vagrant destroy -f | ||
3 | if [ -d host_vars ]; then | ||
4 | rm -rf host_vars | ||
5 | fi | ||
6 | if [ -d .vagrant ]; then | ||
7 | rm -rf .vagrant | ||
8 | fi | ||
diff --git a/defaults/main.yml b/defaults/main.yml index a8d37f4..65c00ba 100644 --- a/defaults/main.yml +++ b/defaults/main.yml | |||
@@ -2,8 +2,8 @@ | |||
2 | # defaults file for ansible-rabbitmq | 2 | # defaults file for ansible-rabbitmq |
3 | config_rabbitmq_ha: false #defines if rabbitmq ha should be configured...define here or in group_vars/group | 3 | config_rabbitmq_ha: false #defines if rabbitmq ha should be configured...define here or in group_vars/group |
4 | enable_rabbitmq_clustering: false #defines if setting up a rabbitmq cluster...define here or in group_vars/group | 4 | enable_rabbitmq_clustering: false #defines if setting up a rabbitmq cluster...define here or in group_vars/group |
5 | erlang_cookie: LSKNKBELKPSTDBBCHETL #define erlang cookie for cluster...define here or in group_vars/group | 5 | erlang_cookie: 'LSKNKBELKPSTDBBCHETL' #define erlang cookie for cluster...define here or in group_vars/group |
6 | erlang_cookie_file: /var/lib/rabbitmq/.erlang.cookie | 6 | erlang_cookie_file: '/var/lib/rabbitmq/.erlang.cookie' |
7 | rabbitmq_config: | 7 | rabbitmq_config: |
8 | - queue_name: logstash | 8 | - queue_name: logstash |
9 | durable: true | 9 | durable: true |
@@ -11,9 +11,13 @@ rabbitmq_config: | |||
11 | type: direct | 11 | type: direct |
12 | routing_key: logstash | 12 | routing_key: logstash |
13 | tags: 'ha-mode=all,ha-sync-mode=automatic' | 13 | tags: 'ha-mode=all,ha-sync-mode=automatic' |
14 | rabbitmq_debian_repo: deb http://www.rabbitmq.com/debian/ testing main | 14 | rabbitmq_debian_repo: 'deb http://www.rabbitmq.com/debian/ testing main' |
15 | rabbitmq_debian_repo_key: http://www.rabbitmq.com/rabbitmq-signing-key-public.asc | 15 | rabbitmq_debian_repo_key: 'http://www.rabbitmq.com/rabbitmq-signing-key-public.asc' |
16 | rabbitmq_master: [] #defines the inventory host that should be considered master...define here or in group_vars/group | 16 | rabbitmq_master: [] #defines the inventory host that should be considered master...define here or in group_vars/group |
17 | rabbitmq_redhat_repo_key: 'https://www.rabbitmq.com/rabbitmq-signing-key-public.asc' | ||
18 | rabbitmq_redhat_package: 'rabbitmq-server-{{ rabbitmq_redhat_version }}-1.noarch.rpm' | ||
19 | rabbitmq_redhat_url: 'http://www.rabbitmq.com/releases/rabbitmq-server/v{{ rabbitmq_redhat_version }}' | ||
20 | rabbitmq_redhat_version: '3.6.1' | ||
17 | rabbitmq_users: #define admin user to create in order to login to WebUI | 21 | rabbitmq_users: #define admin user to create in order to login to WebUI |
18 | - name: rabbitmqadmin | 22 | - name: rabbitmqadmin |
19 | password: rabbitmqadmin | 23 | password: rabbitmqadmin |
diff --git a/handlers/main.yml b/handlers/main.yml index 54a880b..259ce1c 100644 --- a/handlers/main.yml +++ b/handlers/main.yml | |||
@@ -1,4 +1,6 @@ | |||
1 | --- | 1 | --- |
2 | # handlers file for ansible-rabbitmq | 2 | # handlers file for ansible-rabbitmq |
3 | - name: restart rabbitmq-server | 3 | - name: restart rabbitmq-server |
4 | service: name=rabbitmq-server state=restarted | 4 | service: |
5 | name: "rabbitmq-server" | ||
6 | state: restarted | ||
diff --git a/meta/main.yml b/meta/main.yml index 4bd090d..5cb1238 100644 --- a/meta/main.yml +++ b/meta/main.yml | |||
@@ -18,12 +18,12 @@ galaxy_info: | |||
18 | # platform on this list, let us know and we'll get it added! | 18 | # platform on this list, let us know and we'll get it added! |
19 | # | 19 | # |
20 | platforms: | 20 | platforms: |
21 | #- name: EL | 21 | - name: EL |
22 | # versions: | 22 | versions: |
23 | # - all | 23 | # - all |
24 | # - 5 | 24 | # - 5 |
25 | # - 6 | 25 | # - 6 |
26 | # - 7 | 26 | - 7 |
27 | #- name: GenericUNIX | 27 | #- name: GenericUNIX |
28 | # versions: | 28 | # versions: |
29 | # - all | 29 | # - all |
diff --git a/playbook.yml b/playbook.yml new file mode 100644 index 0000000..a9a7bba --- /dev/null +++ b/playbook.yml | |||
@@ -0,0 +1,25 @@ | |||
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 | - config_rabbitmq_ha: true | ||
20 | - enable_rabbitmq_clustering: true | ||
21 | - pri_domain_name: 'test.vagrant.local' | ||
22 | - rabbitmq_master: 'node0' | ||
23 | roles: | ||
24 | - role: ansible-rabbitmq | ||
25 | tasks: | ||
diff --git a/requirements.yml b/requirements.yml new file mode 100644 index 0000000..a1f51cb --- /dev/null +++ b/requirements.yml | |||
@@ -0,0 +1,2 @@ | |||
1 | --- | ||
2 | - src: https://github.com/mrlesmithjr/ansible-rabbitmq.git | ||
diff --git a/tasks/main.yml b/tasks/main.yml index bde00da..1768dd9 100644 --- a/tasks/main.yml +++ b/tasks/main.yml | |||
@@ -2,6 +2,9 @@ | |||
2 | - include: debian.yml | 2 | - include: debian.yml |
3 | when: ansible_os_family == "Debian" | 3 | when: ansible_os_family == "Debian" |
4 | 4 | ||
5 | - include: redhat.yml | ||
6 | when: ansible_os_family == "RedHat" | ||
7 | |||
5 | - name: checking to see if already clustered | 8 | - name: checking to see if already clustered |
6 | stat: path=/etc/rabbitmq/clustered | 9 | stat: path=/etc/rabbitmq/clustered |
7 | register: clustered | 10 | register: clustered |
diff --git a/tasks/redhat.yml b/tasks/redhat.yml new file mode 100644 index 0000000..bf6f1e1 --- /dev/null +++ b/tasks/redhat.yml | |||
@@ -0,0 +1,43 @@ | |||
1 | --- | ||
2 | - name: redhat | installing pre-reqs | ||
3 | yum: | ||
4 | name: "{{ item }}" | ||
5 | state: present | ||
6 | with_items: | ||
7 | - dnf | ||
8 | - epel-release | ||
9 | - python-dnf | ||
10 | when: > | ||
11 | ansible_distribution != "Fedora" | ||
12 | |||
13 | - name: redhat | installing erlang | ||
14 | dnf: | ||
15 | name: "erlang" | ||
16 | state: present | ||
17 | |||
18 | - name: redhat | adding RabbitMQ public GPG key | ||
19 | rpm_key: | ||
20 | key: "{{ rabbitmq_redhat_repo_key }}" | ||
21 | state: present | ||
22 | |||
23 | - name: redhat | downloading RabbitMQ | ||
24 | get_url: | ||
25 | url: "{{ rabbitmq_redhat_url }}/{{ rabbitmq_redhat_package }}" | ||
26 | dest: "/opt/{{ rabbitmq_redhat_package }}" | ||
27 | |||
28 | - name: redhat | installing RabbitMQ | ||
29 | dnf: | ||
30 | name: "/opt/{{ rabbitmq_redhat_package }}" | ||
31 | state: present | ||
32 | |||
33 | - name: redhat | starting and enabling RabbitMQ service | ||
34 | service: | ||
35 | name: "rabbitmq-server" | ||
36 | state: started | ||
37 | enabled: yes | ||
38 | |||
39 | - name: redhat | enabling the RabbitMQ Management Console | ||
40 | rabbitmq_plugin: | ||
41 | names: rabbitmq_management | ||
42 | state: enabled | ||
43 | notify: restart rabbitmq-server | ||