On Thu, 3 Sep 2020 16:48:09 -0700 (PDT)
piya <[email protected]> wrote:

> ... I'd like to capture the result of each task (say, 0 for 
> success, 1 for fail), template something like an html table or ASCII table 
> and then send that to slack instead.

Don't make the code more complex. Use ansible-runner to run the
projects and analyse the potential problems from outside
https://ansible-runner.readthedocs.io/en/latest/

ansible-runner artifacts will provide you with all the details
https://ansible-runner.readthedocs.io/en/latest/intro.html#runner-artifacts-directory-hierarchy
See for example
https://gist.github.com/vbotka/31ccd5380a2b230be11b1df78cc402a1

FWIW. See the example of a script how to run projects via
ansible-runner and create simple log of what succeeded and failed
https://github.com/vbotka/ansible-runner/blob/master/contrib/ansible-cron-audit.bash
https://github.com/vbotka/ansible-runner/blob/master/contrib/arwrapper.bash

The idea is to run the script from cron and receive an email on
failures only. The log can be scanned manually or sent to an external
logging. If a playbook fails go to the ansible-runner artifacts and
find the details. Next step might be the automation of the artifacts'
analysis.

-- 
Vladimir Botka

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20200904065211.6c38a2dc%40gmail.com.

Attachment: pgpyjLPLQuY1S.pgp
Description: OpenPGP digital signature

Reply via email to