ansible-role-rabbitmq/tasks/users.yml

62 lines
1.5 KiB
YAML
Raw Normal View History

2020-12-27 03:52:59 +00:00
---
2020-12-30 00:07:26 +00:00
# No guest users
- name: Remove guest user
community.rabbitmq.rabbitmq_user:
user: guest
state: absent
tags:
- rabbitmq_cluster
# Add the admin user
- name: Create the admin user for our vhosts
community.rabbitmq.rabbitmq_user:
user: rockyadmin
password: "{{ rabbitmq_admin_password }}"
vhost: "{{ item }}"
2020-12-30 02:40:15 +00:00
configure_priv: ".*"
read_priv: ".*"
write_priv: ".*"
2020-12-30 00:07:26 +00:00
tags: administrator
2021-01-23 08:23:20 +00:00
when: "'rabbitmq001' in inventory_hostname"
2020-12-30 00:07:26 +00:00
with_items:
- /
- /pubsub
- /public_pubsub
tags:
- rabbitmq_cluster
- name: Drop the admin password in a file for admin operations
copy:
dest: /root/.rabbitmqpass
content: "{{ rabbitmq_admin_password }}"
mode: '0600'
owner: root
group: root
tags:
- rabbitmq_cluster
# Create a monitoring user as long as the vars are set
- name: Create monitoring user
community.rabbitmq.rabbitmq_user:
user: "{{ rabbitmq_monitoring_username }}"
password: "{{ rabbitmq_monitoring_password }}"
update_password: always
permissions:
- vhost: /
configure_priv: "^$"
read_priv: "^$"
write_priv: "^$"
- vhost: /pubsub
configure_priv: "^$"
read_priv: "^$"
write_priv: "^$"
- vhost: /public_pubsub
configure_priv: "^$"
read_priv: "^$"
write_priv: "^$"
tags: monitoring
when:
2021-01-23 08:23:20 +00:00
- "'rabbitmq001' in inventory_hostname"
2020-12-30 00:07:26 +00:00
- rabbitmq_monitoring_username
- rabbitmq_monitoring_password