# Mitigating deprecation of --one-line and associated callback plugin

**URL:** <https://forum.ansible.com/t/mitigating-deprecation-of-one-line-and-associated-callback-plugin/45965>\
**Category:** Guides, FAQs & Howtos\
**Tags:** callback, deprecation, howto\
**Created:** [June 22, 2026, 4:35pm UTC](https://forum.ansible.com/t/mitigating-deprecation-of-one-line-and-associated-callback-plugin/45965 "2026-06-22T16:35:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [June 22, 2026, 4:35pm UTC](https://forum.ansible.com/t/mitigating-deprecation-of-one-line-and-associated-callback-plugin/45965/1 "2026-06-22T16:35:09Z")

</div>

With the deprecation of the `--one-line` parameter and its associated callback plugin, I’m working on simplifying the use of [a suggested workaround](https://github.com/ansible/ansible/issues/85333#issuecomment-2978583643). First, a little background.

- Everything “interesting” in Ansible is implemented as a plugin.
- _Callback plugins_ control the presentation of the console output from various Ansible commands, particularly `ansible` and `ansible-playbook`.
- The `oneline` callback puts each task’s output for each target host on a single line (so one line per host per task). For some cases, especially ad hoc commands with short task output from many hosts, this can often be much simpler for humans to read.
- The `oneline.py` callback plugin is deprecated and will be removed from ansible-core version 2.23, at the same time the `-o` /`--one-line` parameters will be removed from core commands.
- The suggestion, for those who find `--one-line` occasionally useful, is to use a private copy of the `oneline.py` callback plugin, with the caveat that you’ll own any maintenance issues going forward.

That’s great, but using a one-off callback requires changing some config, either in `ansible.cfg` or environment variables. The ideal would be something nearly as simple as adding `--one-line` to your ad hoc command parameters. That’s possible, but it requires a bit of one-time setup.

First, you’ll need to create a place for your private copy of the `oneline.py` callback plugin. This should be in your DEFAULT\_CALLBACK\_PLUGIN\_PATH; see `ansible-config list` to be sure.

```sh
$ mkdir -p ~/.ansible/plugins/callback

```

Next, copy Ansible’s current `oneline.py` callback plugin to the private `plugins/callback` directory you just created. Give it a slightly different name — here I’m using “`xoneline.py`” — to avoid plugin name collisions before the final removal from ansible-core 2.23.

```sh
$ cp "$(ansible --version | grep -Po '(?<=ansible python module location = ).*')"/plugins/callback/oneline.py ~/.ansible/plugins/callback/xoneline.py

```

Then edit `~/.ansible/plugins/callback/xoneline.py` to comment out the lines pertaining to the pending deprecation of the `oneline` plugin. Don’t be shy about editing that file. _You own it now_. In ansible-core 2.20, that will look something like this:

```python
        # self._display.deprecated( # pylint: disable=ansible-deprecated-unnecessary-collection-name
        # msg='The xoneline callback plugin is deprecated.',
        # version='2.23',
        # deprecator=_deprecator.ANSIBLE_CORE_DEPRECATOR, # entire plugin being removed; this improves the messaging
        # )

```

Finally, create an alias that sets a few environment variables as a prefix to your ad hoc `ansible` commands. You’ll want to update your “dotfiles”, wherever you set your personal shell aliases, to have it defined on subsequent shell sessions.  
N.B. - The trailing space on this alias is important!

```sh
$ alias xoneline='ANSIBLE_CALLBACKS_ENABLED=xoneline ANSIBLE_LOAD_CALLBACK_PLUGINS=true ANSIBLE_STDOUT_CALLBACK=xoneline '

```

Notice this alias doesn’t execute any commands. You invoke the alias as a prefix to your ad hoc `ansible` commands, so that these two ad hoc commands are essentially equivalent (with spaces inserted to facilitate comparison):

```sh
$ ansible my_hosts -a 'uname -r' --one-line
$ xoneline ansible my_hosts -a 'uname -r'

```

Only the latter one (may) work with ansible-core 2.23 and beyond.

The trailing space on that alias causes the word _after_ the alias to also be subject to alias expansion. (See `help alias` in `bash`.) This can be useful if you, like me, have other aliases for specific `ansible` invocations. For example, I have this alias:

```txt
alias ansible-md='ansible -i /path/to/myinventory/hosts -u ansible-mydomain --ssh-extra-args="-i=/path/to/id_rsa_ansible_mydomain"'

```

so that

```sh
$ xoneline ansible-md …

```

expands to a lot more than I want to type. Without the trailing space in the `xoneline` alias definition, my `ansible-md` alias would not expand in that command.

---

<div class="post-metadata">

**Author:** ![kks](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kks/32/10352_2.png) [@kks](https://forum.ansible.com/u/kks)\
**Post date:** [June 22, 2026, 6:09pm UTC](https://forum.ansible.com/t/mitigating-deprecation-of-one-line-and-associated-callback-plugin/45965/2 "2026-06-22T18:09:11Z")

</div>

I never used oneliner functionality, but recently I’ve been thinking that there should be callback plugin that “swallows” almost all the playbook output for the sake of not polluting LLM context. When you want LLM to analyze issue in the role or playbook, it might be beneficial to keep only failed tasks (and maybe some context around them).

That is why oneline callback (or other callback that will hide not important parts) seems like a good idea for LLMs. Thank you for sharing

In few of my projects I’ve adopted following technique - when any CI action is executed with env var LLM=1 almost all output skipped, only failures are shown. I think something similar can be adopted here - run all the playbooks with oneline callback allways on, but it will change anything only if env var is set.

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [June 22, 2026, 7:20pm UTC](https://forum.ansible.com/t/mitigating-deprecation-of-one-line-and-associated-callback-plugin/45965/3 "2026-06-22T19:20:37Z")

</div>

I created a thread about keeping that plugin in a collection (instead of everyone having their own fork): [Add oneline callback to a collection (like community.general)?](https://forum.ansible.com/t/45967)
