kolla-ansible/ansible/roles/service-rabbitmq/tasks/main.yml
Paul Arthur acf9375edc Fix loop label syntax error with ansible-core 2.15
Labels are supposed to be strings, but prior to
https://github.com/ansible/ansible/pull/80040 Ansible
did not enforce this.

Change-Id: Iefad160be12f1b5e689a74a82714857fa867d69a
Signed-off-by: Paul Arthur <paul.arthur@flowerysong.com>
2023-07-27 18:05:47 +00:00

46 lines
1.6 KiB
YAML

---
- block:
- name: "{{ project_name }} | Ensure RabbitMQ vhosts exist"
kolla_toolbox:
container_engine: "{{ kolla_container_engine }}"
module_name: rabbitmq_vhost
module_args:
name: "{{ item }}"
user: rabbitmq
loop: "{{ service_rabbitmq_users | map(attribute='vhost') | unique | reject('equalto', '/') | list }}"
register: service_rabbitmq_result
until: service_rabbitmq_result is success
retries: "{{ service_rabbitmq_retries }}"
delay: "{{ service_rabbitmq_delay }}"
- name: "{{ project_name }} | Ensure RabbitMQ users exist"
kolla_toolbox:
container_engine: "{{ kolla_container_engine }}"
module_name: rabbitmq_user
module_args:
user: "{{ item.user }}"
password: "{{ item.password }}"
node: "rabbit@{{ ansible_facts.hostname }}"
update_password: always
vhost: "{{ item.vhost }}"
configure_priv: ".*"
read_priv: ".*"
tags: "{{ item.tags | default([]) | join(',') }}"
write_priv: ".*"
user: rabbitmq
loop: "{{ service_rabbitmq_users }}"
loop_control:
label: "{{ item.user }} -> {{ item.vhost }}"
register: service_rabbitmq_result
until: service_rabbitmq_result is success
retries: "{{ service_rabbitmq_retries }}"
delay: "{{ service_rabbitmq_delay }}"
no_log: True
become: true
when: service_rabbitmq_when | bool
delegate_to: "{{ service_rabbitmq_delegate_host }}"
run_once: "{{ service_rabbitmq_run_once }}"
tags:
- service-rabbitmq