community.rabbitmq.rabbitmq_policy module – Manage the state of policies in RabbitMQ
Note
This module is part of the community.rabbitmq collection (version 1.6.0).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.rabbitmq.
To use it in a playbook, specify: community.rabbitmq.rabbitmq_policy.
Synopsis
- Manage the state of a policy in RabbitMQ using rabbitmqctl or REST APIs.
Parameters
Parameter | Comments |
|---|---|
apply_to string | What the policy applies to. Requires RabbitMQ 3.2.0 or later. For classic_queues, quorum_queues and streams RabbitMQ 3.12 or later is required Choices:
|
ca_cert path added in community.rabbitmq 1.6.0 | CA certificate to verify SSL connection to management API. |
client_cert path added in community.rabbitmq 1.6.0 | Client certificate to send on SSL connections to management API. |
client_key path added in community.rabbitmq 1.6.0 | Private key matching the client certificate. |
login_host string added in community.rabbitmq 1.6.0 | RabbitMQ host for connection. |
login_password string added in community.rabbitmq 1.6.0 | RabbitMQ password for connection. |
login_port string added in community.rabbitmq 1.6.0 | RabbitMQ management API port. Default: |
login_protocol string added in community.rabbitmq 1.6.0 | RabbitMQ management API protocol. Choices:
|
login_user string added in community.rabbitmq 1.6.0 | RabbitMQ user for connection. |
name string / required | The name of the policy to manage. |
node string | Erlang node name of the rabbit we wish to configure. Default: |
pattern string | A regex of queues to apply the policy to. Required when |
priority string | The priority of the policy. Default: |
state string | The state of the policy. Choices:
|
tags dictionary | A dict or string describing the policy. Required when |
vhost string | The name of the vhost to apply to. Default: |
Examples
- name: Ensure the default vhost contains the HA policy via a dict
community.rabbitmq.rabbitmq_policy:
name: HA
pattern: .*
args:
tags:
ha-mode: all
- name: Ensure the default vhost contains the HA policy
community.rabbitmq.rabbitmq_policy:
name: HA
pattern: .*
tags:
ha-mode: all
- name: Ensure the default vhost contains the HA policy using REST APIs.
community.rabbitmq.rabbitmq_policy:
name: HA
pattern: .*
login_host: localhost
login_user: admin
login_password: changeadmin
tags:
ha-mode: all
Collection links
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/rabbitmq/rabbitmq_policy_module.html