Persistent desktop notification at the end of the job

George Shuklin
OpsOps
Published in
1 min readJan 14, 2019

Ansible (or any other configuration management tool) is great, but it takes a lot of time to finish. Way more than one is expected to stare on running lines. Normal behavior for user is to switch to another task (blog reading? commenting? thinking?). If Ansible finishes, one may be carried away for newly found distraction without noticing that job has done and this means less iterations in a given time.

Notification at the end of run is nice

As usual, this is Linux-desktop approach. There is a simple notify-send utility, and we use it for good:

- name: Notify user
command: notify-send -u critical "ansible has finished"
changed_when: False
failed_when: False

It looks like this:

Example of notification

The critical level is sad (misleading icon) but it has an important property, it keeps floating indefinitely without hiding in a tray.

If ansible tasks are undesirable, a simple addition at the end of the command line will do too:

ansible-playbook -i inventory.yaml site.yaml; notify-send -u critical "ansible has finished"

--

--

George Shuklin
OpsOps

I work at Servers.com, most of my stories are about Ansible, Ceph, Python, Openstack and Linux. My hobby is Rust.