35 lines
977 B
YAML
35 lines
977 B
YAML
# Install a docker based rabbitMQ.
|
|
---
|
|
- 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: make sure service is started
|
|
systemd:
|
|
name: rabbitmq.service
|
|
state: started
|
|
|
|
- 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
|
|
|
|
- name: create openstack user
|
|
command: "docker exec -i rabbitmq.service {{ item }}"
|
|
with_items:
|
|
- rabbitmqctl add_user openstack geheim
|
|
- rabbitmqctl set_permissions openstack ".*" ".*" ".*"
|
|
when: ansible_nodename == hostname_node0
|
|
register: command_result
|
|
failed_when: "command_result.rc not in (0, 70)"
|