-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix playbook to create multinode rabbitmq cluster
- Loading branch information
1 parent
1b105c4
commit cc5c493
Showing
9 changed files
with
73 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
- name: rabbitmq default file | ||
template: | ||
src: "{{ item.src }}" | ||
dest: "{{ item.dest }}" | ||
owner: root | ||
group: root | ||
mode: 0644 | ||
with_items: | ||
- { src: etc/default/rabbitmq-server.j2 , dest: /etc/default/rabbitmq-server } | ||
- { src: etc/rabbitmq/rabbitmq.config.j2, dest: /etc/rabbitmq/rabbitmq.config } | ||
# - { src: etc/rabbitmq/rabbitmq-env.conf.j2, dest: /etc/rabbitmq/rabbitmq-env.conf } | ||
notify: | ||
restart rabbitmq-server | ||
|
||
- name: restart rabbitmq-server | ||
service: | ||
name: rabbitmq-server | ||
state: restarted | ||
|
||
# - name: Enable the plugins is installed | ||
# rabbitmq_plugin: | ||
# names: "{{ item }}" | ||
# prefix: /usr/lib/rabbitmq | ||
# state: enabled | ||
# new_only: yes | ||
# with_items: "{{ rabbitmq_plugins }}" | ||
# notify: | ||
# restart rabbitmq-server | ||
|
||
- name: restart rabbitmq-server | ||
service: | ||
name: rabbitmq-server | ||
state: restarted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
- name: Update /etc/hosts on rmq-cluster nodes | ||
hosts: rmq-cluster | ||
become: yes # This allows the playbook to run with elevated privileges | ||
|
||
tasks: | ||
- name: Add entries to /etc/hosts | ||
lineinfile: | ||
path: /etc/hosts | ||
regexp: "^{{ hostvars[item].ansible_default_ipv4.address }}\\s+{{ item }}\\s+rabbit@{{ item }}$" | ||
line: "{{ hostvars[item].ansible_default_ipv4.address }} {{ item }} rabbit@{{ item }}" | ||
insertbefore: EOF | ||
with_items: "{{ groups['rmq-cluster'] }}" | ||
when: item != inventory_hostname |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
pkg: "{{ item }}" | ||
state: present | ||
with_items: | ||
- rabbitmq-server | ||
- rabbitmq-server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
- name: stop rabbitmq app | ||
command: rabbitmqctl stop_app | ||
|
||
- name: add this node to cluster | ||
command: rabbitmqctl join_cluster rabbit@{{ rabbitmq_cluster_master }} | ||
|
||
- name: start rabbitmq app | ||
command: rabbitmqctl start_app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters