diff options
author | 2015-12-04 09:33:48 +0800 | |
---|---|---|
committer | 2015-12-08 19:36:47 +0800 | |
commit | f691dbc6f7b6d686012fce2f4f6ce59d4549d0fe (patch) | |
tree | e596b2a8e610a6b12bce4878cf2a3cdc0e929f20 /deploy/adapters/ansible/roles/mq/tasks/rabbitmq_install.yml | |
parent | 4d32ee565ecd829a2ec767cae6d8cd23df8e6263 (diff) |
rabbitmq script refactor
JIRA: COMPASS-177
Change-Id: I66698ac27a974c9c375e8da9fcb91f49f89227ed
Signed-off-by: carey.xu <carey.xuhan@huawei.com>
Diffstat (limited to 'deploy/adapters/ansible/roles/mq/tasks/rabbitmq_install.yml')
-rwxr-xr-x | deploy/adapters/ansible/roles/mq/tasks/rabbitmq_install.yml | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/deploy/adapters/ansible/roles/mq/tasks/rabbitmq_install.yml b/deploy/adapters/ansible/roles/mq/tasks/rabbitmq_install.yml new file mode 100755 index 00000000..559fa423 --- /dev/null +++ b/deploy/adapters/ansible/roles/mq/tasks/rabbitmq_install.yml @@ -0,0 +1,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 |