2017-05-16 15:52:22 +02:00
|
|
|
# Install a docker based rabbitMQ.
|
|
|
|
---
|
2017-08-14 16:40:06 +02:00
|
|
|
- name: include secrets
|
|
|
|
include_vars:
|
|
|
|
file: ../../secrets.yml
|
|
|
|
name: secrets
|
|
|
|
|
|
|
|
- include_vars:
|
|
|
|
dir: 'vars'
|
|
|
|
|
2017-05-16 15:52:22 +02:00
|
|
|
- name: install service file.
|
|
|
|
template:
|
|
|
|
src: files/rabbitmq.service
|
|
|
|
dest: /etc/systemd/system/rabbitmq.service
|
|
|
|
mode: 644
|
|
|
|
owner: root
|
|
|
|
group: root
|
2017-07-07 16:14:38 +02:00
|
|
|
|
2017-05-16 15:52:22 +02:00
|
|
|
- name: install service file
|
|
|
|
command: systemctl daemon-reload
|
2017-07-07 16:14:38 +02:00
|
|
|
|
2017-09-29 16:40:38 +02:00
|
|
|
- name: start service at boot.
|
|
|
|
command: systemctl reenable rabbitmq.service
|
|
|
|
|
2017-05-16 15:52:22 +02:00
|
|
|
- name: make sure service is started
|
|
|
|
systemd:
|
|
|
|
name: rabbitmq.service
|
|
|
|
state: started
|
2017-07-07 16:14:38 +02:00
|
|
|
|
2017-08-10 11:17:24 +02:00
|
|
|
- name: wait for container to be started
|
|
|
|
wait_for:
|
2017-08-14 16:40:06 +02:00
|
|
|
port: 5672
|
2017-09-28 16:01:44 +02:00
|
|
|
delay: 5
|
2017-08-10 11:17:24 +02:00
|
|
|
|
2017-07-12 11:40:37 +02:00
|
|
|
- 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
|
2017-07-13 09:42:10 +02:00
|
|
|
|
|
|
|
- name: create openstack user
|
|
|
|
command: "docker exec -i rabbitmq.service {{ item }}"
|
|
|
|
with_items:
|
2017-08-14 16:40:06 +02:00
|
|
|
- rabbitmqctl add_user openstack "{{ secrets['RABBIT_PASSWORD'] }}"
|
2017-07-13 09:42:10 +02:00
|
|
|
- rabbitmqctl set_permissions openstack ".*" ".*" ".*"
|
|
|
|
when: ansible_nodename == hostname_node0
|
2017-08-01 10:19:54 +02:00
|
|
|
register: command_result
|
|
|
|
failed_when: "command_result.rc not in (0, 70)"
|