callbacks example, step by step

552 views
Skip to first unread message

JohnP

unread,
May 19, 2014, 3:54:46 PM5/19/14
to ansible...@googlegroups.com
Hi All,

Can anyone explain "callbacks" mechanism?
As I can see, there are a many callbacks files in ansible/plugins/callbacks/*.py
The format of them more or less "similar". Only the differentiator is the filename.
How do I target the "right one" from my playbook.yml files?
Any example would be truly appreciated.

JohnP

James Cammarata

unread,
May 19, 2014, 8:08:55 PM5/19/14
to ansible...@googlegroups.com
There is no way to specify the callback via a playbook. To use them, you must use the Ansible API directly. Callbacks are used in the ansible and ansible-playbook system scripts, if you want to see how they're used there. Any further questions regarding using the API are best sent to the ansible-devel mailing list, so if you have any further questions let us know there.

Thanks!


--
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/24b0f697-02c8-4679-a01a-487252d10ae3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael DeHaan

unread,
May 21, 2014, 5:56:30 PM5/21/14
to ansible...@googlegroups.com
Not entirely.   They can't be set in playbooks but you *do not* have to use the API.

DEFAULT_CALLBACK_PLUGIN_PATH = get_config(p, DEFAULTS, 'callback_plugins', 'ANSIBLE_CALLBACK_PLUGINS', '/usr/share/ansible_plugins/callback_plugins')


This is from callbacks.py

What this means is that any python files found in the directories found in the variable ANSIBLE_CALLBACK_PLUGINS or any modules copied into /usr/share/ansible_plugins/callback_plugins are automatically loaded and used as callbacks.

Here are a few examples FWIW:

Though I do recommend the devel list and would like to see more activity on it. Feel free to stop by!






Reply all
Reply to author
Forward
0 new messages