mono-infrastructure/ansible/playbooks/adhoc-rabbitmquser.yml

37 lines
888 B
YAML
Raw Permalink Normal View History

2020-12-30 00:03:36 +00:00
---
# This playbook is meant to be used with callable variables, like adhoc or AWX.
# What: Creates RabbitMQ Users
2020-12-30 09:22:58 +00:00
# The username is the required parameter
2020-12-30 00:03:36 +00:00
- name: Create a User
hosts: rabbitmq
become: false
gather_facts: false
vars_files:
2021-01-03 05:18:47 +00:00
- vars/vaults/encpass.yml
2020-12-30 00:03:36 +00:00
- vars/rabbitmq.yml
tasks:
- name: "Checking for user variables"
assert:
that:
- username != "admin"
- username != "guest"
- username != "mq-monitoring"
success_msg: "Required variables provided"
fail_msg: "Username is reserved"
tags:
- rabbitmq
- name: "Creating User Account"
community.rabbitmq.rabbitmq_user:
user: "{{ username }}"
vhost: "{{ vhost }}"
read_priv: "^$"
write_priv: "amq\\.topic"
configure_priv: "^$"
state: present
tags:
- rabbitmq
...