---
- name: ensure python-software-properties is installed
  sudo: yes
  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: add the verification key for the package
  sudo: yes
  shell: curl http://www.rabbitmq.com/rabbitmq-signing-key-public.asc | sudo apt-key add -

- name: update repositories
  apt: update_cache=yes

- name: install rabbitmq
  apt: pkg=rabbitmq-server state=installed force=yes

- name: enable rabbitmq plugins
  rabbitmq_plugin: names={{ item }} state=enabled
  with_items: rabbitmq.plugins

- name: add user
  rabbitmq_user: user={{ rabbitmq.user }} password={{ rabbitmq.password }} tags=administrator,{{ rabbitmq.user }} vhost=/ configure_priv=.* write_priv=.* read_priv=.* state=present

- name: restart rabbitmq
  service: name=rabbitmq-server state=reloaded
---
- name: add rabbitmq official apt repository
  apt_repository: repo='deb http://www.rabbitmq.com/debian/ testing main' state=present

- name: add the verification key for the package
  sudo: yes
  shell: curl http://www.rabbitmq.com/rabbitmq-signing-key-public.asc | sudo apt-key add -

- name: update repositories
  apt: update_cache=yes

- name: install rabbitmq
  apt: pkg=rabbitmq-server state=installed force=yes

- name: enable rabbitmq plugins
  rabbitmq_plugin: names={{ item }} state=enabled
  with_items: rabbitmq.plugins
  when: rabbitmq.plugins is defined

- name: add user
  rabbitmq_user: user={{ rabbitmq.user }} password={{ rabbitmq.password }} node=rabbit@{{ vagrant_local.vm.hostname }} tags=administrator,{{ rabbitmq.user }} vhost=/ configure_priv=.* write_priv=.* read_priv=.* state=present

- name: restart rabbitmq
  service: name=rabbitmq-server state=reloaded
Install plugins only if they were set + add node param when adding an user
Install plugins only if they were set + add node param when adding an user
