Mail Callback With Items

22 views
Skip to first unread message

bobby.c...@ephemeric.online

unread,
Dec 14, 2017, 12:01:31 PM12/14/17
to Ansible Project
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:
Date: Thu, 14 Dec 2017 18:40:36 +0200 (SAST)
From: "Ansible: node03.??????.local" <root@ansible.?????.local>
To: root@ansible.??????.local
Subject: Failed: All items completed

Playbook: rpc.yml
Task: check allowed ports
Module: fail
Host: node03.???????.local

The following task failed:

        check allowed ports (fail)

with the following message:

        All items completed

A complete dump of the error:

        Failed: {"msg": "All items completed", "failed": true, "changed": false}
Reply all
Reply to author
Forward
0 new messages