Brian Coca recently submitted a jabber module for use with Ansible. This module allows an Ansible playbook to connect to an XMPP service and just push out a message, such as “all’s well” or “I’m done”, when, say, a Playbook completes. In addition to the `mail’ module (created by Dag Wieers and heavily improved upon by yours truly :-), I thought I’d add two more.

The first is a module which fires off a message to an IRC channel.

irssi

That was posted to the channel by this play:

---
- hosts: all
  tasks:
  - local_action: irc port=6669 
         channel="#t1"
         msg="Server {{ ansible_hostname }} completed at {{ ansible_date_time.iso8601 }}"
         color=green
         nick=ansibleIRC

The second (very similar) module I created works similarly, but notifies via MQTT. MQTT is the new hotness in the Internet of Things (IoT), and we talked about it here recently. Using this module, Ansible can “notify” by publishing an arbitrary payload to an MQTT topic.

MQTT subscription

That subscription was published to by this play:

---
- hosts: all
  tasks:
  - local_action: mqtt
                  server=localhost
                  port=1883 
                  topic=service/ansible/{{ ansible_hostname }}
                  payload="Server {{ ansible_hostname }} done at {{ ansible_date_time.iso8601 }}"
                  qos=0
                  retain=false
                  client_id=ans001

(Publishing topics to an MQTT broker would also be a neat way of watching Ansible at work with a callback; maybe another time.)