blob: 559fa423adb60734d4c3d792297d5e1878f2260f (
plain)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
---
- name: create rabbitmq directory
file: path=/etc/rabbitmq state=directory mode=0755
- name: disable auto start
copy:
content: "#!/bin/sh\nexit 101"
dest: "/usr/sbin/policy-rc.d"
mode: 0755
when: ansible_os_family == "Debian"
- name: install rabbitmq-server
action: "{{ ansible_pkg_mgr }} name=rabbitmq-server state=present"
with_items: packages | union(packages_noarch)
- name: enable auto start
file:
path=/usr/sbin/policy-rc.d
state=absent
when: ansible_os_family == "Debian"
- name: make sure rabbitmq-server stopped
service:
name: rabbitmq-server
state: stopped
enabled: yes
- name: replace cookie
copy:
content: "{{ ERLANG_TOKEN }}"
dest: /var/lib/rabbitmq/.erlang.cookie
mode: 0400
owner: rabbitmq
group: rabbitmq
- name: replace config
copy:
content: "RABBITMQ_NODE_IP_ADDRESS={{ internal_ip }}"
dest: /etc/rabbitmq/rabbitmq-env.conf
mode: 0400
owner: rabbitmq
group: rabbitmq
- name: set open file limit for rabbitmq
copy:
content: "ulimit -n 65536"
dest: /etc/default/rabbitmq-server
mode: 0400
owner: rabbitmq
group: rabbitmq
- name: restart rabbitmq-server
service:
name: rabbitmq-server
state: restarted
- name: enable queue mirroring
rabbitmq_policy:
name: "ha-all"
pattern: '^(?!amq\.).*'
tags: "ha-mode=all"
- include: rabbitmq_cluster.yml
when: inventory_hostname != haproxy_hosts.keys()[0]
- name: generate mq service list
shell: echo {{ item }} >> /opt/service
with_items: services_noarch
|