# Load callback plugins in the ansible script (GH #8396)

**URL:** <https://forum.ansible.com/t/load-callback-plugins-in-the-ansible-script-gh-8396/15849>\
**Category:** Ansible Developer\
**Created:** [August 4, 2014, 12:44pm UTC](https://forum.ansible.com/t/load-callback-plugins-in-the-ansible-script-gh-8396/15849 "2014-08-04T12:44:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![zeglandos](https://avatars.discourse-cdn.com/v4/letter/z/c57346/32.png) [@zeglandos](https://forum.ansible.com/u/zeglandos)\
**Post date:** [August 4, 2014, 12:44pm UTC](https://forum.ansible.com/t/load-callback-plugins-in-the-ansible-script-gh-8396/15849/1 "2014-08-04T12:44:19Z")

</div>

This is an open discussion, since I’m far from an expert on ansible.

However, since I often run some commands on a lot of host, I’ve written a small callback plugin that summarize output on stdout and stderr.  
I need this callback to be called when running ansible (not the playbook), since I only run once a command, and forget it after that.

So I copied the “callbacks.load\_callback\_  
plugins()” from ansible-playbook. See the [GitHub pull request](https://github.com/ansible/ansible/pull/8396) to see it.

To avoid breaking user experience that are not used to callback in the ansible command, it may be a good idea to implement as an option, e.g. “ansible --callbacks …”

I hope to gather comments on this 🙂

Adrien

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [August 4, 2014, 1:52pm UTC](https://forum.ansible.com/t/load-callback-plugins-in-the-ansible-script-gh-8396/15849/2 "2014-08-04T13:52:28Z")

</div>

So, before, callback plugins were not loaded for /usr/bin/ansible.

I would rather not expand ansible’s CLI options in this case.

The question though, is more of one for users of existing custom callback plugins - if using something like the Hipchat example callback, this would cause _parts_ of output to go to chat, which may be desirable, but it might not in other cases

What we could possibly do is add an [adhoc] section to ansible.cfg and add an option load\_callback\_plugins=True/False

Though I’m also not wanting to make everything super configurable in ansible - that adds complexity to - that may be an alternative.

---

<div class="post-metadata">

**Author:** ![bbasleeper2](https://avatars.discourse-cdn.com/v4/letter/b/a9a28c/32.png) [@bbasleeper2](https://forum.ansible.com/u/bbasleeper2)\
**Post date:** [August 27, 2014, 11:35am UTC](https://forum.ansible.com/t/load-callback-plugins-in-the-ansible-script-gh-8396/15849/3 "2014-08-27T11:35:43Z")

</div>

Hi Guys,

I have the same need to be able to log any actions made through ansible. I work in a company where we are used to manage our unix servers through ssh and custom scripts and i try to train my colleagues to use ansible instead. In the future, using ansible playbooks and roles is probably the best solution but for now, and considering the state of the servers already managed, it’s far easier to just replace custom scripts or launching simple commands through ssh by using ansible cli. But i’d like to be able to log every action made through ansible to have a king of journal of actions and ease the transition to a playbook based management.  
I did the same modification as Adrien to /usr/bin/ansible, and it worked for my needs. I thinks the option in ansible.cfg is a good idea, not something that breaks existing code with a default of false but something really useful. It’s very confusing looking at callback examples and seeing on\_runner\_something and when you try to use them through /usr/bin/ansible, that does not work !!

Bruno

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [August 28, 2014, 9:17pm UTC](https://forum.ansible.com/t/load-callback-plugins-in-the-ansible-script-gh-8396/15849/4 "2014-08-28T21:17:32Z")

</div>

At this point I concur, an option (default off) is probably the best solution.

Let’s make it so, and if there’s a toggle in ansible.cfg I’ll merge it.

Thanks!

---

<div class="post-metadata">

**Author:** ![bbasleeper2](https://avatars.discourse-cdn.com/v4/letter/b/a9a28c/32.png) [@bbasleeper2](https://forum.ansible.com/u/bbasleeper2)\
**Post date:** [September 8, 2014, 5:38pm UTC](https://forum.ansible.com/t/load-callback-plugins-in-the-ansible-script-gh-8396/15849/5 "2014-09-08T17:38:23Z")

</div>

Here is the pull request on github [GH 8911](https://github.com/ansible/ansible/pull/8911)
