# ansible ad-hoc cli command does not respect ANSIBLE\_STDOUT\_CALLBACK

**URL:** <https://forum.ansible.com/t/ansible-ad-hoc-cli-command-does-not-respect-ansible-stdout-callback/21705>\
**Category:** Ansible Project\
**Created:** [June 8, 2016, 8:29pm UTC](https://forum.ansible.com/t/ansible-ad-hoc-cli-command-does-not-respect-ansible-stdout-callback/21705 "2016-06-08T20:29:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Buxton](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@John\_Buxton](https://forum.ansible.com/u/John_Buxton)\
**Post date:** [June 8, 2016, 8:29pm UTC](https://forum.ansible.com/t/ansible-ad-hoc-cli-command-does-not-respect-ansible-stdout-callback/21705/1 "2016-06-08T20:29:19Z")

</div>

I just raised this issue with Ansible which has been immediately closed.

> <https://github.com/ansible/ansible/issues/16194>
>
> \##### ISSUE TYPE
> \- Bug Report
> 
> \##### COMPONENT NAME
> ansible CLI
> 
> \##### ANS…IBLE VERSION
> 
> \`\`\`
> ansible 2.2.0 (devel 3bac945147) last updated 2016/06/03 21:47:13 (GMT +100)
> lib/ansible/modules/core: (detached HEAD 2bd8d78a8b) last updated 2016/06/04 08:22:55 (GMT +100)
> lib/ansible/modules/extras: (detached HEAD b0aec50b9a) last updated 2016/06/04 08:23:00 (GMT +100)
> config file = /home/john/git/ansible-dsh/tests/ansible.cfg
> configured module search path = Default w/o overrides
> \`\`\`
> \##### CONFIGURATION
> 
> \`export ANSIBLE\_STDOUT\_CALLBACK=dsh\`
> \##### OS / ENVIRONMENT
> 
> N/A
> \##### SUMMARY
> 
> The Ansible ad-hoc CLI command (simply called \`ansible\`) does not respect the setting of the \`ANSIBLE\_STDOUT\_CALLBACK\` environment variable. This makes it impossible to customise the output using my own callback plugin.
> 
> For example, I have written a callback plugin called \`dsh\` (a development version can be found \[here\](https://github.com/lqueryvg/ansible-dsh/blob/master/tests/callback\_plugins/dsh.py)) which formats output in a similar fashion to the distributed shell command.
> \##### STEPS TO REPRODUCE
> 
> \`\`\`
> mkdir callback\_plugins
> \# copy my custom dsh.py plugin into the \`callback\_plugins\` directory
> export ANSIBLE\_STDOUT\_CALLBACK=myplugin
> export ANSIBLE\_HOST\_KEY\_CHECKING=False
> 
> ansible -i hosts all -m ping
> \`\`\`
> \##### EXPECTED RESULTS
> 
> I expect my \`dsh\` plugin to be used, to create output as follows:
> 
> \`\`\`
> host1: Wed Jun 8 19:55:49 UTC 2016
> host2: Wed Jun 8 19:55:49 UTC 2016
> \`\`\`
> \##### ACTUAL RESULTS
> 
> The usual \`minimal\` plugin is used instead.
> 
> \`\`\`
> host1 | SUCCESS | rc=0 \>\>
> Wed Jun 8 19:55:35 UTC 2016
> 
> host2 | SUCCESS | rc=0 \>\>
> Wed Jun 8 19:55:35 UTC 2016
> \`\`\`

I’m going to copy / paste my report verbatim so as to avoid repeating myself all over again (hopefully the formatting doesn’t screw up).

##### ISSUE TYPE- Bug Report

##### ANSIBLE VERSION

```auto
ansible 2.2.0 (devel 3bac945147) last updated 2016/06/03 21:47:13 (GMT +100)
  lib/ansible/modules/core: (detached HEAD 2bd8d78a8b) last updated 2016/06/04 08:22:55 (GMT +100)
  lib/ansible/modules/extras: (detached HEAD b0aec50b9a) last updated 2016/06/04 08:23:00 (GMT +100)
  config file = /home/john/git/ansible-dsh/tests/ansible.cfg
  configured module search path = Default w/o overrides

```

##### CONFIGURATION

`export ANSIBLE_STDOUT_CALLBACK=dsh`

##### OS / ENVIRONMENT

N/A

##### SUMMARY

The Ansible ad-hoc CLI command (simply called `ansible`) does not respect the setting of the `ANSIBLE_STDOUT_CALLBACK` environment variable. This makes it impossible to customise the output using my own callback plugin.

For example, I have written a callback plugin called `dsh` (a development version can be found [here](https://github.com/lqueryvg/ansible-dsh/blob/master/tests/callback_plugins/dsh.py)) which formats output in a similar fashion to the distributed shell command.

##### STEPS TO REPRODUCE
