kestra-io / kestra-io/plugin-ansible
Any AnsibleCLI task that doesn't override ansibleConfig dies straight away
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 2
- Forks
- 6
- Avg merge
- 17h 5m
- Merged PRs (30d)
- 6
Description
Describe the issue
Ran into this building some blueprints that use Ansible. Any AnsibleCLI task that doesn't override ansibleConfig dies straight away:
[ERROR]: Could not load 'ansible.builtin.null' callback plugin.
io.kestra.core.models.tasks.runners.TaskException: Command failed with exit code 1
The generated ansible.cfg sets stdout_callback = ansible.builtin.null, and that callback doesn't exist. I assumed it was a recent Ansible removal, but it's older than that: null.py is in ansible 2.9 and gone from 2.10 onwards. The builtin callbacks have been the same the whole way from 2.16 to 2.21, just default, junit, minimal, oneline, tree.
Reproduced on Kestra 2.0.1 / plugin-ansible 1.6.8 with the process runner, and outside Kestra with nothing but those two lines in an ansible.cfg:
ansible-core 2.21.4 → Could not load 'ansible.builtin.null' callback plugin., exit 1
ansible-core 2.17.14 → Invalid callback for stdout specified: ansible.builtin.null, exit 1
Can't just delete the line though. The outputsMode docs say EXPLICIT needs that null callback, otherwise another stdout callback prints per-host payloads itself and the redaction never sees them.
What I think works: we already ship callback_plugins/kestra_logger.py and the generated config already points callback_plugins at that directory, so we can drop a small null.py in next to it and reference it unqualified:
callback_plugins = ./callback_plugins
callbacks_enabled = kestra_logger
stdout_callback = null
from ansible.plugins.callback import CallbackBase
DOCUMENTATION = '''
name: null
type: stdout
short_description: Suppress all stdout output
description: Does not display any output on stdout.
'''
class CallbackModule(CallbackBase):
CALLBACK_VERSION = 2.0
CALLBACK_TYPE = 'stdout'
CALLBACK_NAME = 'null'
Tried it on both 2.21.4 and 2.17.14, exit 0 and nothing on stdout, so EXPLICIT redaction still holds.
Three spots mention the old name: AnsibleCLI.java:212 (the doc example), :334 (the actual default) and the outputsMode description at :345.
Workaround in the meantime is env: ANSIBLE_STDOUT_CALLBACK: default on the task, but that gives up EXPLICIT redaction so it's not one to leave on if the playbook output is sensitive.
Environment
- Kestra Version: develop
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in AnsibleCLI.java at lines 212, 334, and 345, then inspect the existing callback_plugins/kestra_logger.py and generated Ansible configuration. Verify the replacement callback behavior with ansible-core 2.17.14 and 2.21.4; done means tasks using the default ansibleConfig exit successfully while EXPLICIT output redaction remains effective.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ansible, java, python
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100