rss.png profile for ebal on Stack Exchange, a network of free, community-driven Q&A sites
ansible register

So here is a nice ansible trick to trigger a notify if only the exit status of a command is zero (without any errors)

  - name: Check named
    shell: /sbin/named-checkconf
    register: named_checkconf
    changed_when: "named_checkconf.rc == 0"
    notify: rndc reconfig

the named_checkconf contains the below values:

"changed": true,
"cmd": ["/sbin/rndc", "reconfig"],
"delta": "0:00:02.438532",
"end": "2015-04-07 15:02:21.349859",
"item": "",
"rc": 0,
"start": "2015-04-07 15:02:18.911327",
"stderr": "",
"stdout": ""
Tag(s): ansible, bind