community.rabbitmq.rabbitmq_binding 模块 – 管理 RabbitMQ 绑定

注意

此模块是 community.rabbitmq 集合 (版本 1.3.0) 的一部分。

如果您正在使用 ansible 包,则您可能已安装此集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用:ansible-galaxy collection install community.rabbitmq。您需要其他要求才能使用此模块,请参阅 要求 获取详细信息。

要在 playbook 中使用它,请指定:community.rabbitmq.rabbitmq_binding

概要

  • 此模块使用 RabbitMQ REST API 来创建/删除绑定。

要求

执行此模块的主机需要以下要求。

  • requests >= 1.0.0

参数

参数

注释

arguments

字典

交换机的额外参数。如果定义了此参数,则它是一个键值字典

默认值: {}

ca_cert

别名:cacert

路径

用于验证与管理 API 的 SSL 连接的 CA 证书。

client_cert

别名:cert

路径

在与管理 API 的 SSL 连接上发送的客户端证书。

client_key

别名:key

路径

与客户端证书匹配的私钥。

destination

别名:dst, dest

字符串 / 必需

绑定的目标交换机或队列。

destination_type

别名:type, dest_type

字符串 / 必需

队列或交换机。

选项

  • "queue"

  • "exchange"

login_host

字符串

RabbitMQ 连接主机。

默认值: "localhost"

login_password

字符串

RabbitMQ 连接密码。

默认值: "guest"

login_port

字符串

RabbitMQ 管理 API 端口。

默认值: "15672"

login_protocol

字符串

RabbitMQ 管理 API 协议。

选项

  • "http" ← (默认)

  • "https"

login_user

字符串

RabbitMQ 连接用户。

默认值: "guest"

name

别名:src, source

字符串 / 必需

要创建绑定的源交换机。

routing_key

字符串

绑定的路由键。

默认值: "#"

state

字符串

绑定是否应该存在或不存在。

选项

  • "present" ← (默认)

  • "absent"

vhost

字符串

RabbitMQ 虚拟主机。

默认值: "/"

示例

- name: Bind myQueue to directExchange with routing key info
  community.rabbitmq.rabbitmq_binding:
    name: directExchange
    destination: myQueue
    type: queue
    routing_key: info

- name: Bind directExchange to topicExchange with routing key *.info
  community.rabbitmq.rabbitmq_binding:
    name: topicExchange
    destination: topicExchange
    type: exchange
    routing_key: '*.info'

作者

  • Manuel Sousa (@manuel-sousa)