diff options
author | shuai chen <chenshuai@huawei.com> | 2015-12-10 06:52:34 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2015-12-10 06:52:35 +0000 |
commit | 01bf8315641200a49964d378d0ff88f43e7d8bf5 (patch) | |
tree | 1e64c6d17c126005bda0f7e8b963f5466f042a3c /deploy/adapters/ansible/roles/mq/tasks/rabbitmq_install.yml | |
parent | e408668e84f138f69317ff63e68b823dfe80188b (diff) | |
parent | f691dbc6f7b6d686012fce2f4f6ce59d4549d0fe (diff) |
Merge "rabbitmq script refactor"
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 |