ansible-ops-management/tasks/rabbitmq/users.yml
2023-07-22 21:25:14 -07:00

39 lines
1.4 KiB
YAML

---
- name: Remove users from rabbitmq
community.rabbitmq.rabbitmq_user:
user: "{{ item.user }}"
state: absent
loop: "{{ rabbitmq_users }}"
when: item.state == 'absent'
- name: Add and configure single vhost users
community.rabbitmq.rabbitmq_user:
user: "{{ item.user }}"
password: "{{ item.password | default(omit) }}"
update_password: "{{ item.update_password | default(omit) }}"
topic_permissions: "{{ item.topic_permissions | default(omit) }}"
configure_priv: "{{ item.configure_priv | default(omit) }}"
write_priv: "{{ item.write_priv | default(omit) }}"
read_priv: "{{ item.read_priv | default(omit) }}"
vhost: "{{ item.vhost }}"
tags: "{{ item.tags | default(omit) }}"
loop: "{{ rabbitmq_users }}"
when:
- item.vhost is defined
- rabbitmq_cluster_list[0] in inventory_hostname
- name: Add and configure multi vhost users
community.rabbitmq.rabbitmq_user:
user: "{{ item.user }}"
password: "{{ item.password | default(omit) }}"
update_password: "{{ item.update_password | default(omit) }}"
topic_permissions: "{{ item.topic_permissions | default(omit) }}"
permissions: "{{ item.permissions | default([]) }}"
tags: "{{ item.tags | default(omit) }}"
loop: "{{ rabbitmq_users }}"
when:
- item.vhost is not defined
- item.permissions is defined
- rabbitmq_cluster_list[0] in inventory_hostname
...