Publish a message on an MQTT topic.
- mosquitto
parameter | required | default | choices | comments |
---|---|---|---|---|
client_id |
no | hostname + pid | MQTT client identifier | |
password |
no | Password for username to authenticate against the broker. | ||
payload |
yes | Payload. The special string "None" may be used to send a NULL (i.e. empty) payload which is useful to simply notify with the topic or to clear previously retained messages. | ||
port |
no | 1883 | MQTT broker port number | |
qos |
no |
|
QoS (Quality of Service) | |
retain |
no | Setting this flag causes the broker to retain (i.e. keep) the message so that applications that subsequently subscribe to the topic can received the last retained message immediately. | ||
server |
no | localhost | MQTT broker address/name | |
topic |
yes | MQTT topic name | ||
username |
no | Username to authenticate against the broker. |
- local_action: mqtt topic=service/ansible/{{ ansible_hostname }} payload="Hello at {{ ansible_date_time.iso8601 }}" qos=0 retain=false client_id=ans001
Note
This module requires a connection to an MQTT broker such as Mosquitto http://mosquitto.org and the Paho mqtt
Python client (https://pypi.python.org/pypi/paho-mqtt).
For more information on what this means please read Extras Modules
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Helping Testing PRs and Developing Modules.