community.rabbitmq.rabbitmq_exchange module – Manage rabbitMQ exchange

Note

This module is part of the community.rabbitmq collection (version 1.4.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. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: community.rabbitmq.rabbitmq_exchange.

Synopsis

  • This module uses rabbitMQ Rest API to create/delete exchanges

Requirements

The below requirements are needed on the host that executes this module.

  • requests >= 1.0.0

Parameters

Parameter

Comments

arguments

dictionary

Extra arguments for exchange. If defined this argument is a key/value dictionary.

Default: {}

auto_delete

boolean

If the exchange should delete itself after all queues/exchanges unbound from it.

Choices:

  • false ← (default)

  • true

ca_cert

aliases: cacert

path

CA certificate to verify SSL connection to management API.

client_cert

aliases: cert

path

Client certificate to send on SSL connections to management API.

client_key

aliases: key

path

Private key matching the client certificate.

durable

boolean

Whether exchange is durable or not.

Choices:

  • false

  • true ← (default)

exchange_type

aliases: type

string

Type for the exchange.

If using x-delayed-message, x-random, x-consistent-hash or x-recent-history the respective plugin on

the RabbitMQ server must be enabled.

Choices:

  • "fanout"

  • "direct" ← (default)

  • "headers"

  • "topic"

  • "x-delayed-message"

  • "x-random"

  • "x-consistent-hash"

  • "x-recent-history"

internal

boolean

Exchange is available only for other exchanges.

Choices:

  • false ← (default)

  • true

login_host

string

RabbitMQ host for connection.

Default: "localhost"

login_password

string

RabbitMQ password for connection.

Default: "guest"

login_port

string

RabbitMQ management API port.

Default: "15672"

login_protocol

string

RabbitMQ management API protocol.

Choices:

  • "http" ← (default)

  • "https"

login_user

string

RabbitMQ user for connection.

Default: "guest"

name

string / required

Name of the exchange to create.

state

string

Whether the exchange should be present or absent.

Choices:

  • "present" ← (default)

  • "absent"

vhost

string

RabbitMQ virtual host.

Default: "/"

Examples

- name: Create direct exchange
  community.rabbitmq.rabbitmq_exchange:
    name: directExchange

- name: Create topic exchange on vhost
  community.rabbitmq.rabbitmq_exchange:
    name: topicExchange
    type: topic
    vhost: myVhost

Authors

  • Manuel Sousa (@manuel-sousa)