diff options
Diffstat (limited to 'tasks')
-rw-r--r-- | tasks/rabbitmq_clustering.yml | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/tasks/rabbitmq_clustering.yml b/tasks/rabbitmq_clustering.yml index a34ff92..a87bb2b 100644 --- a/tasks/rabbitmq_clustering.yml +++ b/tasks/rabbitmq_clustering.yml | |||
@@ -5,37 +5,44 @@ | |||
5 | - name: rabbitmq_clustering | resetting rabbitmq app | 5 | - name: rabbitmq_clustering | resetting rabbitmq app |
6 | command: rabbitmqctl reset | 6 | command: rabbitmqctl reset |
7 | 7 | ||
8 | - name: rabbitmq_clustering | stopping rabbitmq-server | ||
9 | service: name=rabbitmq-server state=stopped | ||
10 | |||
8 | - name: rabbitmq_clustering | copy erlang cookie | 11 | - name: rabbitmq_clustering | copy erlang cookie |
9 | template: src=erlang.cookie.j2 dest=/var/lib/rabbitmq/.erlang.cookie owner=rabbitmq group=rabbitmq mode=0400 backup=yes | 12 | template: src=erlang.cookie.j2 dest=/var/lib/rabbitmq/.erlang.cookie owner=rabbitmq group=rabbitmq mode=0400 backup=yes |
10 | 13 | ||
11 | - name: rabbitmq_clustering | starting rabbitmq app | 14 | - name: rabbitmq_clustering | restarting rabbitmq-server on master |
15 | service: name=rabbitmq-server state=restarted | ||
16 | when: inventory_hostname == "{{ rabbitmq_master }}" | ||
17 | |||
18 | - name: rabbitmq_clustering | starting rabbitmq app on master | ||
12 | command: rabbitmqctl start_app | 19 | command: rabbitmqctl start_app |
13 | register: cluster_master | 20 | register: cluster_master |
14 | when: master_rabbit_node is defined and master_rabbit_node | 21 | when: inventory_hostname == "{{ rabbitmq_master }}" |
15 | 22 | ||
16 | - name: rabbitmq_clustering | sending sigterm to any running rabbitmq processes | 23 | - name: rabbitmq_clustering | sending sigterm to any running rabbitmq processes |
17 | shell: pkill -u rabbitmq || true | 24 | shell: pkill -u rabbitmq || true |
18 | when: (master_rabbit_node is defined and not master_rabbit_node) and cluster_master.changed | 25 | when: inventory_hostname != "{{ rabbitmq_master }}" and cluster_master.changed |
19 | 26 | ||
20 | - name: rabbitmq_clustering | restarting rabbitmq-server | 27 | - name: rabbitmq_clustering | restarting rabbitmq-server |
21 | service: name=rabbitmq-server state=restarted | 28 | service: name=rabbitmq-server state=restarted |
22 | when: (master_rabbit_node is defined and not master_rabbit_node) and cluster_master.changed | 29 | when: inventory_hostname != "{{ rabbitmq_master }}" and cluster_master.changed |
23 | 30 | ||
24 | - name: rabbitmq_clustering | stopping rabbitmq app | 31 | - name: rabbitmq_clustering | stopping rabbitmq app |
25 | command: rabbitmqctl stop_app | 32 | command: rabbitmqctl stop_app |
26 | when: (master_rabbit_node is defined and not master_rabbit_node) and cluster_master.changed | 33 | when: inventory_hostname != "{{ rabbitmq_master }}" and cluster_master.changed |
27 | 34 | ||
28 | - name: rabbitmq_clustering | resetting rabbitmq app | 35 | - name: rabbitmq_clustering | resetting rabbitmq app |
29 | command: rabbitmqctl reset | 36 | command: rabbitmqctl reset |
30 | when: (master_rabbit_node is defined and not master_rabbit_node) and cluster_master.changed | 37 | when: inventory_hostname != "{{ rabbitmq_master }}" and cluster_master.changed |
31 | 38 | ||
32 | - name: rabbitmq_clustering | joining rabbitmq cluster | 39 | - name: rabbitmq_clustering | joining rabbitmq cluster |
33 | command: rabbitmqctl join_cluster 'rabbit@{{ master_rabbit_node }}' | 40 | command: rabbitmqctl join_cluster 'rabbit@{{ master_rabbit_node }}' |
34 | when: (master_rabbit_node is defined and not master_rabbit_node) and cluster_master.changed | 41 | when: inventory_hostname != "{{ rabbitmq_master }}" and cluster_master.changed |
35 | 42 | ||
36 | - name: rabbitmq_clustering | starting rabbitmq app | 43 | - name: rabbitmq_clustering | starting rabbitmq app |
37 | command: rabbitmqctl start_app | 44 | command: rabbitmqctl start_app |
38 | when: (master_rabbit_node is defined and not master_rabbit_node) and cluster_master.changed | 45 | when: inventory_hostname != "{{ rabbitmq_master }}" and cluster_master.changed |
39 | 46 | ||
40 | - name: rabbitmq_clustering | marking as clustered | 47 | - name: rabbitmq_clustering | marking as clustered |
41 | file: path=/etc/rabbitmq/clustered state=touch | 48 | file: path=/etc/rabbitmq/clustered state=touch |