35 lines
960 B
YAML
35 lines
960 B
YAML
|
---
|
||
|
- hosts: rabbitmq
|
||
|
sudo: true
|
||
|
vars:
|
||
|
rabbitmq_version: 3.0.2-1
|
||
|
|
||
|
tasks:
|
||
|
- name: ensure python-software-properties is installed
|
||
|
apt: pkg=python-software-properties state=installed
|
||
|
|
||
|
- name: add rabbitmq official apt repository
|
||
|
apt_repository: repo='deb http://www.rabbitmq.com/debian/ testing main' state=present
|
||
|
|
||
|
- name: install rabbitmq
|
||
|
apt: pkg=rabbitmq-server=$rabbitmq_version state=installed force=yes
|
||
|
|
||
|
- name: enable rabbitmq plugins
|
||
|
rabbitmq_plugin: names=rabbitmq_management,rabbitmq_tracing state=enabled
|
||
|
notify:
|
||
|
- restart rabbitmq
|
||
|
|
||
|
- name: add users
|
||
|
rabbitmq_user: user=$item password=changeme tags=monitoring,$item vhost="/" configure_priv=".*" write_priv=".*" read_priv=".*" state=present
|
||
|
with_items:
|
||
|
- user1
|
||
|
- user2
|
||
|
|
||
|
- name: remove default guest user
|
||
|
rabbitmq_user: user=guest state=absent
|
||
|
|
||
|
handlers:
|
||
|
- name: restart rabbitmq
|
||
|
service: name=rabbitmq-server state=restarted
|
||
|
|