hpc-cloud/roles/rabbitmq/tasks/main.yml

40 lines
902 B
YAML

# Install a docker based rabbitMQ.
---
- name: include secrets
include_vars:
file: ../../secrets.yml
name: secrets
- name: install service file.
template:
src: files/rabbitmq.service
dest: /etc/systemd/system/rabbitmq.service
mode: 644
owner: root
group: root
- name: install service file
command: systemctl daemon-reload
- name: start service at boot.
command: systemctl reenable rabbitmq.service
- name: make sure service is started
systemd:
name: rabbitmq.service
state: started
- name: wait for container to be started
wait_for:
port: 5672
delay: 5
- name: setup the cluster
command: "docker exec -i rabbitmq.service {{ item }}"
with_items:
- rabbitmqctl stop_app
- "rabbitmqctl join_cluster rabbit_{{ hostname_node0 }}@{{ hostname_node0 }}"
- rabbitmqctl start_app
when: ansible_nodename != hostname_node0