aboutsummaryrefslogtreecommitdiffhomepage
path: root/tasks/rabbitmq_clustering.yml
blob: 40a776f5349a6cdefa16ae4f45bb5cf1fe63b329 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
- name: rabbitmq_clustering | stopping rabbitmq app
  command: rabbitmqctl stop_app

- name: rabbitmq_clustering | resetting rabbitmq app
  command: rabbitmqctl reset

- name: rabbitmq_clustering | stopping rabbitmq-server
  service: name=rabbitmq-server state=stopped

- name: rabbitmq_clustering | copy erlang cookie
  template: src=erlang.cookie.j2 dest=/var/lib/rabbitmq/.erlang.cookie owner=rabbitmq group=rabbitmq mode=0400 backup=yes

- name: rabbitmq_clustering | restarting rabbitmq-server on master
  service: name=rabbitmq-server state=restarted
  when: inventory_hostname == "{{ rabbitmq_master }}"

- name: rabbitmq_clustering | starting rabbitmq app on master
  command: rabbitmqctl start_app
  register: cluster_master
  when: inventory_hostname == "{{ rabbitmq_master }}"

- name: rabbitmq_clustering | sending sigterm to any running rabbitmq processes
  shell: pkill -u rabbitmq || true
  when: inventory_hostname != "{{ rabbitmq_master }}"

- name: rabbitmq_clustering | restarting rabbitmq-server
  service: name=rabbitmq-server state=restarted
  when: inventory_hostname != "{{ rabbitmq_master }}"

- name: rabbitmq_clustering | stopping rabbitmq app
  command: rabbitmqctl stop_app
  when: inventory_hostname != "{{ rabbitmq_master }}"

- name: rabbitmq_clustering | resetting rabbitmq app
  command: rabbitmqctl reset
  when: inventory_hostname != "{{ rabbitmq_master }}"

- name: rabbitmq_clustering | joining rabbitmq cluster
  command: rabbitmqctl join_cluster 'rabbit@{{ master_rabbit_node }}'
  when: inventory_hostname != "{{ rabbitmq_master }}"

- name: rabbitmq_clustering | starting rabbitmq app
  command: rabbitmqctl start_app
  when: inventory_hostname != "{{ rabbitmq_master }}"

- name: rabbitmq_clustering | marking as clustered
  file: path=/etc/rabbitmq/clustered state=touch
  when: cluster_master.changed