ansible-role-rabbitmq/tasks/users.yml

90 lines
2.2 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
2020-12-30 00:07:26 +00:00
tags:
- rabbitmq_cluster
- name: Drop the admin password in a file for admin operations
2022-03-28 03:04:38 +00:00
ansible.builtin.copy:
2020-12-30 00:07:26 +00:00
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
2020-12-30 00:07:26 +00:00
configure_priv: "^$"
read_priv: "^$"
write_priv: "^$"
- vhost: public_pubsub
2020-12-30 00:07:26 +00:00
configure_priv: "^$"
read_priv: "^$"
write_priv: "^$"
tags: monitoring
when:
2021-01-23 08:23:20 +00:00
- "'rabbitmq001' in inventory_hostname"
2021-01-27 09:51:14 +00:00
- rabbitmq_monitoring_username is defined
- rabbitmq_monitoring_password is defined
2021-01-28 21:09:24 +00:00
# Add MBS
- name: Create MBS User
community.rabbitmq.rabbitmq_user:
user: "mbs"
password: "{{ rabbitmq_mbs_password }}"
update_password: always
vhost: mbs
2021-03-15 07:46:14 +00:00
configure_priv: ".*"
read_priv: ".*"
write_priv: ".*"
2021-01-28 21:09:24 +00:00
when:
- "'rabbitmq001' in inventory_hostname"
2021-02-04 22:16:44 +00:00
- rabbitmq_mbs_password is defined
2021-02-23 18:17:09 +00:00
# Add distrobuild
- name: Create distrobuild User
community.rabbitmq.rabbitmq_user:
user: "distrobuild"
password: "{{ rabbitmq_mbs_password }}"
update_password: always
vhost: distrobuild
2021-03-15 07:46:14 +00:00
configure_priv: ".*"
read_priv: ".*"
write_priv: ".*"
2021-02-23 18:17:09 +00:00
when:
- "'rabbitmq001' in inventory_hostname"
- rabbitmq_distrobuild_password is defined