----
# tasks file for ansible-rabbitmq
-- name: Add the RabbitMQ public GPG key to the apt repo
- apt_key: url=http://www.rabbitmq.com/rabbitmq-signing-key-public.asc state=present
+- include: debian.yml
+ when: ansible_os_family == "Debian"
-- name: Add RabbitMQ to the sources list
- apt_repository: repo='deb http://www.rabbitmq.com/debian/ testing main' update_cache=no state=present
+- include: redhat.yml
+ when: >
+ ansible_distribution == "CentOS" or
+ ansible_distribution == "Red Hat Enterprise Linux" or
+ ansible_distribution == "OracleLinux"
-- name: Install RabbitMQ server
- apt: name={{ item }} update_cache=no force=yes state=installed
- with_items:
- - rabbitmq-server
+- include: fedora.yml
+ when: ansible_distribution == "Fedora"
-- name: Enable the RabbitMQ Management Console
- rabbitmq_plugin: names=rabbitmq_management state=enabled
- notify: restart rabbitmq-server
+- include: config.yml
+ when: rabbitmq_config_service
-- name: Ensure that the RabbitMQ service is running
- service: name=rabbitmq-server state=started enabled=yes
-
-- name: check | checking to see if already clustered
+- name: checking to see if already clustered
stat: path=/etc/rabbitmq/clustered
+ become: true
register: clustered
- include: rabbitmq_clustering.yml
- when: enable_rabbitmq_clustering and (clustered.stat.exists != True)
+ when: >
+ rabbitmq_enable_clustering and
+ not clustered['stat']['exists']
- include: rabbitmq_ha_config.yml
- when: config_rabbitmq_ha and enable_rabbitmq_clustering
+ when: >
+ rabbitmq_config_ha and
+ rabbitmq_enable_clustering and
+ rabbitmq_config is defined
+
+- include: rabbitmq_users.yml
+ when: rabbitmq_users is defined