ANSIBLE_CALLBACK_PLUGINS in envvars is not working. #219
Updated: July,9 2020
Status: Closed without fix Aug 2019
It’s not possible to change Ansible callback
plugin. ansible-runner
ignores environment variable
ANSIBLE_STDOUT_CALLBACK
and uses hardwired callback plugins (2,4). See
runner_config.py
1if 'AD_HOC_COMMAND_ID' in self.env:
2 self.env['ANSIBLE_STDOUT_CALLBACK'] = 'minimal'
3else:
4 self.env['ANSIBLE_STDOUT_CALLBACK'] = 'awx_display'
To test it, set the environment variables of the project test_02
shell> cat ~/.ansible/runner/test_02/env/envvars
---
MY_TEST_VAR: my-test-var
ANSIBLE_STDOUT_CALLBACK: actionable
Prepare a playbook
shell> cat pb-02.yml
- hosts: test_02
remote_user: admin
gather_facts: true
tasks:
- debug:
msg: "HOME [{{ lookup('env','HOME') }}]"
- debug:
msg: "MY_TEST_VAR [{{ lookup('env','MY_TEST_VAR') }}]"
- debug:
msg: "ANSIBLE_STDOUT_CALLBACK [{{ lookup('env','ANSIBLE_STDOUT_CALLBACK') }}]"
and test it
shell> ansible-runner --version
1.4.6
shell> ansible-runner run ~/.ansible/runner/test_02 -p pb-02.yml
TASK [debug] *******************************************************************
ok: [test_02] => {
"msg": "HOME [/home/admin]"
}
TASK [debug] *******************************************************************
ok: [test_02] => {
"msg": "MY_TEST_VAR [my-test-var]"
}
TASK [debug] *******************************************************************
ok: [test_02] => {
"msg": "ANSIBLE_STDOUT_CALLBACK [awx_display]"
}