Customized error message on failed task?

I have googled this, and found I am not the first to ask. I have the following:

`

  • name: Check if NetworkManager is running
    shell: “systemctl status NetworkManager”
    register: nm_status
    changed_when: false
    ignore_errors: yes
    when: ansible_distribution_major_version == ‘7’
    `

When it errors out, thanks to systemd, there is a whole bunch of garbage. I would like the following instead
msg: “NetworkManager not enabled”

I haven’t been able to get this to work yet with what I have googled… anyone else been able to do something like this?

I can suppress it with the following, but I haven’t been able to customize it

no_log: true

You would need to write you own callback plugin, or check the included ones to see if one of them suit your need.
https://github.com/ansible/ansible/tree/devel/lib/ansible/plugins/callback