vars and tasks swap

This commit is contained in:
Louis Abel 2023-07-15 00:25:46 -07:00
parent cc42eb6dad
commit ede3065837
Signed by: label
GPG Key ID: 3331F061D1D9990E
2 changed files with 89 additions and 90 deletions

View File

@ -1,61 +1,34 @@
---
rabbitmq_users:
- user: guest
- name: Remove users from rabbitmq
community.rabbitmq.rabbitmq_user:
user: "{{ item.user }}"
state: absent
- user: rockyadmin
state: present
tags: "administrator"
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: ".*"
- vhost: mbs
configure_priv: ".*"
read_priv: ".*"
write_priv: ".*"
- vhost: distrobuild
configure_priv: ".*"
read_priv: ".*"
write_priv: ".*"
- vhost: odcs
configure_priv: ".*"
read_priv: ".*"
write_priv: ".*"
- user: mbs
state: present
configure_priv: ".*"
read_priv: ".*"
write_priv: ".*"
vhost: mbs
- user: distrobuild
state: present
configure_priv: ".*"
read_priv: ".*"
write_priv: ".*"
vhost: distrobuild
- user: rockymonitor
state: present
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: 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
- 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 }}"
tags: "{{ item.tags | default(omit) }}"
loop: "{{ rabbitmq_users }}"
when:
- item.vhost is not defined
- item.permissions is defined
...

View File

@ -1,35 +1,61 @@
---
- name: Remove users from rabbitmq
community.rabbitmq.rabbitmq_user:
user: "{{ item.user }}"
rabbitmq_users:
- user: guest
state: absent
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
- 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) }}"
permissions: "{{ item.permissions }}"
topic_permissions: "{{ item.topic_permissions|default(omit) }}"
vhost: "{{ item.vhost }}"
tags: "{{ item.tags|default(omit) }}"
loop: "{{ rabbitmq_users }}"
when:
- item.vhost is not defined
- item.permissions is defined
- user: rockyadmin
state: present
tags: "administrator"
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: ".*"
- vhost: mbs
configure_priv: ".*"
read_priv: ".*"
write_priv: ".*"
- vhost: distrobuild
configure_priv: ".*"
read_priv: ".*"
write_priv: ".*"
- vhost: odcs
configure_priv: ".*"
read_priv: ".*"
write_priv: ".*"
- user: mbs
state: present
configure_priv: ".*"
read_priv: ".*"
write_priv: ".*"
vhost: mbs
- user: distrobuild
state: present
configure_priv: ".*"
read_priv: ".*"
write_priv: ".*"
vhost: distrobuild
- user: rockymonitor
state: present
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"
...