New in version 2.8.
The below requirements are needed on the host that executes this module.
Parameter | Choices/Defaults | Comments |
---|---|---|
auto_delete boolean |
| Set the queue to auto delete. |
body - | The body of the message. A body cannot be provided if a src is specified. | |
content_type - | Default: "text/plain" | The content type of the body. |
durable boolean |
| Set the queue to be durable. |
exchange - | The exchange to publish a message to. | |
exclusive boolean |
| Set the queue to be exclusive. |
headers dictionary | Default: {} | A dictionary of headers to post with the message. |
host - | The RabbitMQ server hostname or IP. | |
password - | The RabbitMQ password. | |
port - | The RabbitMQ server port. | |
proto - |
| The protocol to use. |
queue - | The queue to publish a message to. If no queue is specified, RabbitMQ will return a random queue name. | |
routing_key - | The routing key. | |
src - | A file to upload to the queue. Automatic mime type detection is attempted if content_type is not defined (left as default). A src cannot be provided if a body is specified.The filename is added to the headers of the posted message to RabbitMQ. Key being the filename , value is the filename.aliases: file | |
url - | An URL connection string to connect to the RabbitMQ server.
url and host/port/user/pass/vhost are mutually exclusive, use either or but not both. | |
username - | The RabbitMQ username. | |
vhost - | The virtual host to target. If default vhost is required, use '%2F' . |
Note
- name: Publish a message to a queue with headers 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 rabbitmq_publish: url: "amqp://guest:[email protected]:5672/%2F" queue: 'images' file: 'path/to/logo.gif' - name: RabbitMQ auto generated queue rabbitmq_publish: url: "amqp://guest:[email protected]:5672/%2F" body: "Hello world random queue from ansible module rabbitmq_publish" content_type: "text/plain"
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
result dictionary | success | Contains the status msg, content type content_type and the queue name queue. Sample: 'result': { 'content_type': 'text/plain', 'msg': 'Successfully published to queue test', 'queue': 'test' } |
Hint
If you notice any issues in this documentation, you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.9/modules/rabbitmq_publish_module.html