Hi,
I’m running Ansible 2.4.1.0.
I have the below but for some reason I’m not getting the expected behaviour.
Maybe I’m wrong or have assumed incorrectly?
I’m expecting the mail callback plugin to output the fail msg.
Please can someone suggest a change or workaround?
Thank you.
`
- name: check allowed ports
tags: ports
fail:
msg: “Ansible: Alert - Rogue Port {{ item }}”
with_items: “{{ ports_var.stdout_lines }}”
failed_when: - “item not in ports_lookup_var”
`
If I run by hand:
ansible-playbook playbooks/rpc.yml --limit=warp.???.local --tags ports
`
TASK [check allowed ports] *****************************************************
failed: [warp.???.local] (item=127.0.0.1:1196) => {“changed”: false, “failed”: true, “failed_when_result”: true, “item”: “127.0.0.1:1196”, “msg”: “Ansible: Alert - Rogue Port 127.0.0.1:1196”}
ok: [warp.???.local] => (item=*:22)
ok: [warp.???.local] => (item=127.0.0.1:25)
ok: [warp.???.local] => (item=127.0.0.1:8090)
to retry, use: --limit @/home/ansible/playbooks/rpc.retry
PLAY RECAP *********************************************************************
warp.gsoc.local : ok=1 changed=1 unreachable=0 failed=1
`
The mail received:
`