If you're running Job Templates in AWX you might want to look into Notification Templates ( https://ansible.readthedocs.io/projects/awx/en/latest/userguide/notifications.html), and specifically Email ( https://ansible.readthedocs.io/projects/awx/en/latest/userguide/notifications.html#email )
You could also look into callback plugins ( https://docs.ansible.com/ansible/latest/plugins/callback.html#example-callback-plugins ) On Sun, 16 Jun 2024 at 15:56, Luiz Gustavo <[email protected]> wrote: > Hey guys, > > How to access the playbook execution log file at run time? I would need to > email it after running the playbook. > > For example, a simple playbook: > > --- > - hosts: localhost > tasks: > - name: "display message" > debug: > msg: "Hello" > > I would need to email the execution output: > > > > > > > > > > > > > *PLAY [localhost] > *********************************************************************************************************************************************TASK > [Gathering Facts] > ***************************************************************************************************************************************ok: > [localhost]TASK [display message] > ***************************************************************************************************************************************ok: > [localhost] => { "msg": "Hello"}PLAY RECAP > ***************************************************************************************************************************************************localhost > : ok=2 changed=0 unreachable=0 failed=0 > skipped=0 rescued=0 ignored=0 * > > PS.: > I cannot set the ANSIBLE_LOG_PATH environment variable before executing > the playbook because the execution will be done through AWX and not through > the command line. > > -- > 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/CAL-Q%3DKvUjWhhAE5mmhpU8r8FSS0EzkzKH-zGivBLf3%2BjZqq65Q%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CAL-Q%3DKvUjWhhAE5mmhpU8r8FSS0EzkzKH-zGivBLf3%2BjZqq65Q%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- 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/CAKtKohQPSyOmOQPN80nRTndRWARbuxBajJLoDdo8nSD45xQ_hQ%40mail.gmail.com.
