delegate to first in list
This commit is contained in:
parent
ede3065837
commit
818d64787a
6 changed files with 31 additions and 14 deletions
|
@ -58,9 +58,10 @@
|
|||
state: restarted
|
||||
|
||||
- name: restart_rabbitmq
|
||||
ansible.builtin.service:
|
||||
ansible.builtin.systemd:
|
||||
name: rabbitmq-server
|
||||
state: restarted
|
||||
daemon_reload: true
|
||||
|
||||
- name: enable_crb
|
||||
ansible.builtin.shell: "set -o pipefail && /usr/bin/crb enable"
|
||||
|
|
|
@ -25,9 +25,6 @@ roles:
|
|||
- name: rockylinux.kojid
|
||||
src: https://github.com/rocky-linux/ansible-role-kojid
|
||||
version: main
|
||||
- name: rockylinux.rabbitmq
|
||||
src: https://github.com/rocky-linux/ansible-role-rabbitmq
|
||||
version: main
|
||||
- name: rockylinux.sigul
|
||||
src: https://github.com/rocky-linux/ansible-role-sigul
|
||||
version: main
|
||||
|
|
|
@ -50,6 +50,8 @@
|
|||
content: |
|
||||
[Service]
|
||||
LimitNOFILE={{ rabbitmq_file_limit }}
|
||||
notify:
|
||||
- restart_rabbitmq
|
||||
|
||||
# We are doing it the command line way
|
||||
- name: Enable RabbitMQ Plugins
|
||||
|
@ -83,6 +85,13 @@
|
|||
immediate: true
|
||||
loop: "{{ rabbitmq_ports }}"
|
||||
|
||||
- name: Ensure RabbitMQ is running
|
||||
ansible.builtin.systemd:
|
||||
name: rabbitmq-server
|
||||
state: started
|
||||
enabled: true
|
||||
daemon_reload: true
|
||||
|
||||
- name: Non-master nodes should wait for 001 to be up first
|
||||
ansible.builtin.wait_for:
|
||||
host: "{{ rabbitmq_cluster_list[0] }}"
|
||||
|
@ -90,13 +99,7 @@
|
|||
delay: '15'
|
||||
connect_timeout: '10'
|
||||
state: started
|
||||
when: "'rabbitmq001' not in inventory_hostname"
|
||||
|
||||
- name: Ensure RabbitMQ is running
|
||||
ansible.builtin.service:
|
||||
name: rabbitmq-server
|
||||
state: started
|
||||
enabled: true
|
||||
when: rabbitmq_cluster_list[0] not in inventory_hostname
|
||||
|
||||
- name: Drop the admin password in a file if available
|
||||
ansible.builtin.copy:
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
vhost: "{{ item.vhost }}"
|
||||
tags: "{{ item.tags | default(omit) }}"
|
||||
loop: "{{ rabbitmq_users }}"
|
||||
when: item.vhost is defined
|
||||
when:
|
||||
- item.vhost is defined
|
||||
- rabbitmq_cluster_list[0] in inventory_hostname
|
||||
|
||||
- name: Add and configure multi vhost users
|
||||
community.rabbitmq.rabbitmq_user:
|
||||
|
@ -25,10 +27,11 @@
|
|||
password: "{{ item.password | default(omit) }}"
|
||||
update_password: "{{ item.update_password | default(omit) }}"
|
||||
topic_permissions: "{{ item.topic_permissions | default(omit) }}"
|
||||
permissions: "{{ item.permissions }}"
|
||||
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
|
||||
...
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
- name: Create virtual hosts
|
||||
- name: Create or remove virtual hosts
|
||||
delegate_to: "{{ rabbitmq_cluster_list[0] }}"
|
||||
community.rabbitmq.rabbitmq_vhost:
|
||||
name: "{{ item.vhost }}"
|
||||
state: "{{ item.state }}"
|
||||
|
@ -8,6 +9,7 @@
|
|||
- rabbitmq_cluster
|
||||
|
||||
- name: Manage virtual host policies
|
||||
delegate_to: "{{ rabbitmq_cluster_list[0] }}"
|
||||
community.rabbitmq.rabbitmq_policy:
|
||||
name: "{{ item.1.name }}"
|
||||
apply_to: "{{ item.1.apply_to }}"
|
||||
|
|
|
@ -53,4 +53,15 @@ rabbitmq_ports:
|
|||
- 15672/tcp
|
||||
- 25672/tcp
|
||||
- 35672-35682/tcp
|
||||
|
||||
# Rabbitmq plugins
|
||||
rabbitmq_plugins:
|
||||
- rabbitmq_amqp1_0
|
||||
- rabbitmq_auth_backend_ldap
|
||||
- rabbitmq_auth_mechanism_ssl
|
||||
- rabbitmq_management
|
||||
- rabbitmq_mqtt
|
||||
- rabbitmq_federation
|
||||
- rabbitmq_federation_management
|
||||
- rabbitmq_peer_discovery_common
|
||||
...
|
||||
|
|
Loading…
Reference in a new issue