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

34 lines
1.3 KiB
YAML

---
- 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
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
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