On Mon, 25 Jul 2022 19:06:33 +0200
Daniel Gonçalves <ansi...@lves.fr> wrote:

> What I want to do is executing some code at the end of the playbook 
> execution, in other words executing some code at some arbitrary playbook 
> execution step. I wonder if there is some event listener I can subscribe 
> on in order to execute my code.

This depends on the use case:

1) To execute the code at the end of the playbook you can use
   *post_tasks*. At some arbitrary playbook execution step use
   *tasks*.

2) To trigger the execution of a code by some events you can use
   the module *wait_for*
   
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/wait_for_module.html#ansible-builtin-wait-for-module-waits-for-a-condition-before-continuing
   and *handlers*
   https://docs.ansible.com/ansible/latest/user_guide/playbooks_handlers.html

3) To execute the code after the playbook finished you can use
   *ansible-runner*
   
https://ansible-runner.readthedocs.io/en/stable/python_interface/#usage-examples


-- 
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20220725215524.6aaab024%40gmail.com.

Attachment: pgppsViJXWnql.pgp
Description: OpenPGP digital signature

Reply via email to