# Ansible YAML output: community.general.yaml has been deprecated

**URL:** <https://forum.ansible.com/t/ansible-yaml-output-community-general-yaml-has-been-deprecated/39480>\
**Category:** Get Help\
**Tags:** azure, kubernetes, windows, vmware, aws, awx, galaxy-ng\
**Created:** [January 6, 2025, 6:20pm UTC](https://forum.ansible.com/t/ansible-yaml-output-community-general-yaml-has-been-deprecated/39480 "2025-01-06T18:20:22Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![chris](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chris/32/293_2.png) [@chris](https://forum.ansible.com/u/chris)\
**Post date:** [January 6, 2025, 6:20pm UTC](https://forum.ansible.com/t/ansible-yaml-output-community-general-yaml-has-been-deprecated/39480/1 "2025-01-06T18:20:23Z")

</div>

With a `ansible.cfg` containing:

```ini
stdout_callback = community.general.yaml
result_format = yaml

```

YAML output is generated, for example:

```bash
ansible-playbook update.yml -t update -l host.example.com -C --diff -v
Using ansible.cfg as config file
[DEPRECATION WARNING]: community.general.yaml has been deprecated. The plugin has been superseded by the the option 
`result_format=yaml` in callback plugin ansible.builtin.default from ansible-core 2.13 onwards. This feature will be removed from 
community.general in version 13.0.0. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.

PLAY [Update and reboot servers] *****************************************************************************************************

TASK [update_reboot : Gather facts if using tags] ************************************************************************************
ok: [host.example.com]

TASK [update_reboot : Update apt cache] **********************************************************************************************
ok: [host.example.com] => changed=false
  cache_update_time: 1736186964
  cache_updated: true

TASK [update_reboot : Check for available updates] ***********************************************************************************
ok: [host.example.com] => changed=false
  msg: |-
    Reading package lists...
    Building dependency tree...
    Reading state information...
    Calculating upgrade...
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
  stderr: ''
  stderr_lines: <omitted>
  stdout: |-
    Reading package lists...
    Building dependency tree...
    Reading state information...
    Calculating upgrade...
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
  stdout_lines: <omitted>

```

When `stdout_callback = community.general.yaml` is commented out JSON format is generated:

```bash
ansible-playbook update.yml -t update -l host.example.com -C --diff -v
Using ansible.cfg as config file

PLAY [Update and reboot servers] *****************************************************************************************************

TASK [update_reboot : Gather facts if using tags] ************************************************************************************
ok: [host.example.com]

TASK [update_reboot : Update apt cache] **********************************************************************************************
ok: [host.example.com] => {cache_update_time: 1736186997, cache_updated: true, changed: false}

TASK [update_reboot : Check for available updates] ***********************************************************************************
ok: [host.example.com] => {changed: false, msg: Reading package lists...\nBuilding dependency tree...\nReading state information...\nCalculating upgrade.
..\n0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.\n, stderr: "", stderr_lines: [], stdout: Reading package lists...\nBuilding depende
ncy tree...\nReading state information...\nCalculating upgrade...\n0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.\n, stdout_lines: [Readin
g package lists..., Building dependency tree..., Reading state information..., Calculating upgrade..., 0 upgraded, 0 newly installed, 0 to remove and 
0 not upgraded.]}

```

This is with Ansible core `2.17.7`:

```bash
ansible --version
ansible [core 2.17.7]
  config file = /home/chris/.ansible.cfg
  configured module search path = ['/home/chris/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/chris/.local/pipx/venvs/ansible/lib/python3.11/site-packages/ansible
  ansible collection location = /home/chris/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/chris/.local/bin/ansible
  python version = 3.11.2 (main, Sep 14 2024, 03:00:30) [GCC 12.2.0] (/home/chris/.local/pipx/venvs/ansible/bin/python)
  jinja version = 3.1.5
  libyaml = True

```

And the following collections:

```bash
ansible-galaxy collection list

# /home/chris/.ansible/collections/ansible_collections
Collection Version
---------------------------------------- -------
ansible.posix 2.0.0  
community.crypto 2.23.0 
community.docker 4.3.0  
community.general 10.2.0 
community.library_inventory_filtering_v1 1.0.0  
community.mysql 3.11.0 
community.postgresql 3.9.1  
community.rabbitmq 1.4.0  

# /home/chris/.local/pipx/venvs/ansible/lib/python3.11/site-packages/ansible_collections
Collection Version
---------------------------------------- -------
amazon.aws 8.2.1  
ansible.netcommon 6.1.3  
ansible.posix 1.6.2  
ansible.utils 4.1.0  
ansible.windows 2.5.0  
arista.eos 9.0.0  
awx.awx 24.6.1 
azure.azcollection 2.7.0  
check_point.mgmt 5.2.3  
chocolatey.chocolatey 1.5.3  
cisco.aci 2.10.1 
cisco.asa 5.0.1  
cisco.dnac 6.25.0 
cisco.intersight 2.0.20 
cisco.ios 8.0.0  
cisco.iosxr 9.0.0  
cisco.ise 2.9.6  
cisco.meraki 2.18.3 
cisco.mso 2.9.0  
cisco.nxos 8.1.0  
cisco.ucs 1.14.0 
cloud.common 3.0.0  
cloudscale_ch.cloud 2.4.0  
community.aws 8.0.0  
community.ciscosmb 1.0.9  
community.crypto 2.22.3 
community.digitalocean 1.27.0 
community.dns 3.1.0  
community.docker 3.13.3 
community.general 9.5.2  
community.grafana 1.9.1  
community.hashi_vault 6.2.0  
community.hrobot 2.0.2  
community.library_inventory_filtering_v1 1.0.2  
community.libvirt 1.3.0  
community.mongodb 1.7.8  
community.mysql 3.11.0 
community.network 5.1.0  
community.okd 3.0.1  
community.postgresql 3.9.0  
community.proxysql 1.6.0  
community.rabbitmq 1.3.0  
community.routeros 2.20.0 
community.sap_libs 1.4.2  
community.sops 1.9.1  
community.vmware 4.8.1  
community.windows 2.3.0  
community.zabbix 2.5.1  
containers.podman 1.16.2 
cyberark.conjur 1.3.1  
cyberark.pas 1.0.30 
dellemc.enterprise_sonic 2.5.1  
dellemc.openmanage 9.9.0  
dellemc.powerflex 2.5.0  
dellemc.unity 2.0.0  
f5networks.f5_modules 1.32.1 
fortinet.fortimanager 2.8.2  
fortinet.fortios 2.3.8  
frr.frr 2.0.2  
google.cloud 1.4.1  
grafana.grafana 5.6.0  
hetzner.hcloud 3.1.1  
ibm.qradar 3.0.0  
ibm.spectrum_virtualize 2.0.0  
ibm.storage_virtualize 2.5.0  
ieisystem.inmanage 2.0.0  
infinidat.infinibox 1.4.5  
infoblox.nios_modules 1.7.1  
inspur.ispim 2.2.3  
inspur.sm 2.3.0  
junipernetworks.junos 8.0.0  
kaytus.ksmanage 1.2.2  
kubernetes.core 3.2.0  
kubevirt.core 1.5.0  
lowlydba.sqlserver 2.3.4  
microsoft.ad 1.7.1  
netapp.cloudmanager 21.24.0
netapp.ontap 22.13.0
netapp.storagegrid 21.13.0
netapp_eseries.santricity 1.4.1  
netbox.netbox 3.20.0 
ngine_io.cloudstack 2.5.0  
ngine_io.exoscale 1.1.0  
openstack.cloud 2.3.0  
openvswitch.openvswitch 2.1.1  
ovirt.ovirt 3.2.0  
purestorage.flasharray 1.32.0 
purestorage.flashblade 1.19.1 
sensu.sensu_go 1.14.0 
splunk.es 3.0.0  
t_systems_mms.icinga_director 2.0.1  
telekom_mms.icinga_director 2.2.1  
theforeman.foreman 4.2.0  
vmware.vmware 1.7.1  
vmware.vmware_rest 3.2.0  
vultr.cloud 1.13.0 
vyos.vyos 4.1.0  
wti.remote 1.0.10 

```

What I’m wondering is, what do I need to change in `ansible.cfg` in order to generate YAML output and not get a deprecation warning?

---

<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:** [January 6, 2025, 6:33pm UTC](https://forum.ansible.com/t/ansible-yaml-output-community-general-yaml-has-been-deprecated/39480/2 "2025-01-06T18:33:19Z")

</div>

```ini
[defaults]
result_format=yaml

```

or in your shell  
`export ANSIBLE_CALLBACK_RESULT_FORMAT=yaml`

See `ansible-doc -t callback ansible.builtin.default` for more, like `pretty_results`/`ANSIBLE_CALLBACK_FORMAT_PRETTY`.

---

<div class="post-metadata">

**Author:** ![chris](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chris/32/293_2.png) [@chris](https://forum.ansible.com/u/chris)\
**Post date:** [January 6, 2025, 6:43pm UTC](https://forum.ansible.com/t/ansible-yaml-output-community-general-yaml-has-been-deprecated/39480/3 "2025-01-06T18:43:00Z")

</div>

> [@utoddl](#):
>
> ```auto
> [defaults]
> result_format=yaml
> 
> ```

I have that already, but I get JSON output.

---

<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:** [January 6, 2025, 6:46pm UTC](https://forum.ansible.com/t/ansible-yaml-output-community-general-yaml-has-been-deprecated/39480/4 "2025-01-06T18:46:41Z")

</div>

Perhaps you have `ANSIBLE_STDOUT_CALLBACK=yaml` in your environment?  
That would override settings from and `ansible.cfg`.

---

<div class="post-metadata">

**Author:** ![chris](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chris/32/293_2.png) [@chris](https://forum.ansible.com/u/chris)\
**Post date:** [January 6, 2025, 6:51pm UTC](https://forum.ansible.com/t/ansible-yaml-output-community-general-yaml-has-been-deprecated/39480/5 "2025-01-06T18:51:45Z")

</div>

That variable is not set:

```bash
echo $ANSIBLE_STDOUT_CALLBACK

```

However this works:

> [@utoddl](#):
>
> in your shell  
> `export ANSIBLE_CALLBACK_RESULT_FORMAT=yaml`

What I don’t get is why having this in `ansible.cfg` doesn’t work? I get JSON output with this:

```ini
[defaults]

# Use YAML rather than JSON for stdout
# stdout_callback = community.general.yaml
result_format = yaml

```

And a _“community.general.yaml has been deprecated”_ warning when it is uncommented – so the file is being parsed:

> [DEPRECATION WARNING]: community.general.yaml has been deprecated. The plugin has been superseded by the the option  
> `result_format=yaml` in callback plugin ansible.builtin.default from ansible-core 2.13 onwards. This feature will be removed from  
> community.general in version 13.0.0. Deprecation warnings can be disabled by setting deprecation\_warnings=False in ansible.cfg.

---

<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:** [January 6, 2025, 6:57pm UTC](https://forum.ansible.com/t/ansible-yaml-output-community-general-yaml-has-been-deprecated/39480/6 "2025-01-06T18:57:47Z")

</div>

What do you get from `ansible-config dump --only-changed`?

I suspect your community.general.yaml knows it’s being deprecated, but your slightly older ansible install doesn’t know to use the newer settings? (Now I’m just guessing.)

---

<div class="post-metadata">

**Author:** ![flowerysong](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/flowerysong/32/2305_2.png) [@flowerysong](https://forum.ansible.com/u/flowerysong)\
**Post date:** [January 6, 2025, 6:57pm UTC](https://forum.ansible.com/t/ansible-yaml-output-community-general-yaml-has-been-deprecated/39480/7 "2025-01-06T18:57:48Z")

</div>

The INI setting is named `callback_result_format`, not just `result_format`. [ansible.builtin.default callback – default Ansible screen output — Ansible Community Documentation](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/default_callback.html#parameter-result_format)

---

<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:** [January 6, 2025, 7:29pm UTC](https://forum.ansible.com/t/ansible-yaml-output-community-general-yaml-has-been-deprecated/39480/8 "2025-01-06T19:29:48Z")

</div>

Interesting. I would have thought that changing `callback_result_format` from `yaml` to `json` — which does cause the expected output changes — would also be reflected in the output from `ansible-config dump --only-changed`. But it isn’t. The config dumps are identical.

```auto
$ ansible-config --version
ansible-config [core 2.16.12]
  config file = /home/utoddl/ansible/ansible.cfg
  configured module search path = ['/home/utoddl/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.13/site-packages/ansible
  ansible collection location = /home/utoddl/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible-config
  python version = 3.13.1 (main, Dec 9 2024, 00:00:00) [GCC 14.2.1 20240912 (Red Hat 14.2.1-3)] (/usr/bin/python3)
  jinja version = 3.1.4
  libyaml = True

```

---

<div class="post-metadata">

**Author:** ![flowerysong](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/flowerysong/32/2305_2.png) [@flowerysong](https://forum.ansible.com/u/flowerysong)\
**Post date:** [January 6, 2025, 7:44pm UTC](https://forum.ansible.com/t/ansible-yaml-output-community-general-yaml-has-been-deprecated/39480/9 "2025-01-06T19:44:42Z")

</div>

Since it’s part of a plugin config you need `-t all` (this isn’t the default for backwards compatibility reasons) or `-t callback`:

```plaintext
$ ansible-config dump --only-changed -t callback

ara_default:
___________
api_client(env: ARA_API_CLIENT) = http
api_server(env: ARA_API_SERVER) = http://127.0.0.1:8082
localhost_as_hostname_format(/home/ec2-user/ansible-aws/ansible/ansible.cfg) = hostname

default:
_______
result_format(/home/ec2-user/ansible-aws/ansible/ansible.cfg) = yaml

minimal:
_______
result_format(/home/ec2-user/ansible-aws/ansible/ansible.cfg) = yaml

```

---

<div class="post-metadata">

**Author:** ![chris](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chris/32/293_2.png) [@chris](https://forum.ansible.com/u/chris)\
**Post date:** [January 6, 2025, 8:10pm UTC](https://forum.ansible.com/t/ansible-yaml-output-community-general-yaml-has-been-deprecated/39480/10 "2025-01-06T20:10:41Z")

</div>

> [@flowerysong](#):
>
> The INI setting is named `callback_result_format`, not just `result_format`.

Ah, thanks!

Should this warning be updated to match to save people like me following it?

> The plugin has been superseded by the the option `result_format=yaml` in callback plugin ansible.builtin.default from ansible-core 2.13 onwards. This feature will be removed from community.general in version 13.0.0.

---

<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:** [January 6, 2025, 8:29pm UTC](https://forum.ansible.com/t/ansible-yaml-output-community-general-yaml-has-been-deprecated/39480/11 "2025-01-06T20:29:06Z")

</div>

Extending the deprecation message to include `callback_result_format` and `ANSIBLE_CALLBACK_RESULT_FORMAT` is definitely a good idea.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [February 5, 2025, 8:29pm UTC](https://forum.ansible.com/t/ansible-yaml-output-community-general-yaml-has-been-deprecated/39480/12 "2025-02-05T20:29:35Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
