ansible-roles/library/roles/rabbitmq/tasks/main.yml

34 lines
1.3 KiB
YAML
Raw Normal View History

---
- block:
- name: Install the rabbitMQ repository key
apt_key: url='{{ rabbitmq_repo_key }}' state=present
- name: Install the rabbitMQ PPA
apt_repository: repo='{{ rabbitmq_repo }}' state=present
- name: Install the rabbitMQ package
2019-03-25 13:15:39 +01:00
apt: pkg={{ rabbitmq_server_pkg }} state={{ rabbitmq_pkg_state }} update_cache=yes
- name: Set the rabbitMQ max files
lineinfile: name={{ rabbitmq_default_f }} regexp="^ulimit" line="ulimit -n {{ rabbitmq_fileno }}"
notify: rabbitmq restart
- name: Enable some rabbitMQ plugins
rabbitmq_plugin: names={{ rabbitmq_enabled_plugins }} state=enabled
- name: Disable some rabbitMQ plugins
2019-03-25 13:15:39 +01:00
rabbitmq_plugin: names={{ rabbitmq_disabled_plugins | default([]) }} state=disabled
- name: Create an admin user
rabbitmq_user: user={{ rabbitmq_admin_u }} password={{ rabbitmq_admin_pwd | default('changemeASAP') }} tags=administrator vhost=/ configure_priv=.* read_priv=.* write_priv=.* state=present
- name: Start and enable the rabbitMQ service
service: name=rabbitmq-server state=started enabled=yes
when: rabbitmq_enabled
- name: Stop and disable the rabbitMQ service
service: name=rabbitmq-server state=stopped enabled=no
when: not rabbitmq_enabled
tags: rabbitmq