community.rabbitmq.rabbitmq_publish – Publish a message to a RabbitMQ queue.¶
Note
This plugin is part of the community.rabbitmq collection (version 1.0.1).
To install it use: ansible-galaxy collection install community.rabbitmq
.
To use it in a playbook, specify: community.rabbitmq.rabbitmq_publish
.
Parameters¶
Notes¶
Note
This module requires the pika python library https://pika.readthedocs.io/.
Pika is a pure-Python implementation of the AMQP 0-9-1 protocol that tries to stay fairly independent of the underlying network support library.
This module is tested against RabbitMQ. Other AMQP 0.9.1 protocol based servers may work but not tested/guaranteed.
The certificate authentication was tested with certificates created via https://www.rabbitmq.com/ssl.html#automated-certificate-generation and RabbitMQ configuration variables
ssl_options.verify = verify_peer
&ssl_options.fail_if_no_peer_cert = true
.
Examples¶
- name: Publish a message to a queue with headers
community.rabbitmq.rabbitmq_publish:
url: "amqp://guest:[email protected]:5672/%2F"
queue: 'test'
body: "Hello world from ansible module rabbitmq_publish"
content_type: "text/plain"
headers:
myHeader: myHeaderValue
- name: Publish a file to a queue
community.rabbitmq.rabbitmq_publish:
url: "amqp://guest:[email protected]:5672/%2F"
queue: 'images'
file: 'path/to/logo.gif'
- name: RabbitMQ auto generated queue
community.rabbitmq.rabbitmq_publish:
url: "amqp://guest:[email protected]:5672/%2F"
body: "Hello world random queue from ansible module rabbitmq_publish"
content_type: "text/plain"
- name: Publish with certs
community.rabbitmq.rabbitmq_publish:
url: "amqps://guest:[email protected]:5671/%2F"
body: "Hello test queue from ansible module rabbitmq_publish via SSL certs"
queue: 'test'
content_type: "text/plain"
cafile: 'ca_certificate.pem'
certfile: 'client_certificate.pem'
keyfile: 'client_key.pem'
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Authors¶
John Imison (@Im0)