ansible-ops-management/tasks/rabbitmq/users.yml

38 lines
1.3 KiB
YAML
Raw Normal View History

2023-07-15 07:10:52 +00:00
---
2023-07-15 07:25:46 +00:00
- name: Remove users from rabbitmq
community.rabbitmq.rabbitmq_user:
user: "{{ item.user }}"
2023-07-15 07:10:52 +00:00
state: absent
2023-07-15 07:25:46 +00:00
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 }}"
2023-07-16 01:51:26 +00:00
when:
- item.vhost is defined
- rabbitmq_cluster_list[0] in inventory_hostname
2023-07-15 07:25:46 +00:00
- 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) }}"
2023-07-16 01:51:26 +00:00
permissions: "{{ item.permissions | default([]) }}"
2023-07-15 07:25:46 +00:00
tags: "{{ item.tags | default(omit) }}"
loop: "{{ rabbitmq_users }}"
when:
- item.vhost is not defined
- item.permissions is defined
2023-07-16 01:51:26 +00:00
- rabbitmq_cluster_list[0] in inventory_hostname
2023-07-15 07:10:52 +00:00
...