#  Deprecation warnings with ansible-core 2.20.2

**URL:** <https://forum.ansible.com/t/deprecation-warnings-with-ansible-core-2-20-2/45286>\
**Category:** Get Help\
**Tags:** awx, ansible-core, galaxy-ng, kubernetes\
**Created:** [February 6, 2026, 6:46pm UTC](https://forum.ansible.com/t/deprecation-warnings-with-ansible-core-2-20-2/45286 "2026-02-06T18:46:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tsgsh](https://avatars.discourse-cdn.com/v4/letter/t/a8b319/32.png) [@tsgsh](https://forum.ansible.com/u/tsgsh)\
**Post date:** [February 6, 2026, 6:46pm UTC](https://forum.ansible.com/t/deprecation-warnings-with-ansible-core-2-20-2/45286/1 "2026-02-06T18:46:42Z")

</div>

I installed ansible-core 2.20.2 yesterday (I’ve been using the version provided with EL9 until now, but needed some uplevel collections to be installed). I’m getting deprecation warnings for `ansible.module_utils.common._collections_compat` and various `ansible.module_utils._*`, including `_text` but I get them without using any external collections that I see. I can’t see anything wrong with the installation of ansible-core which was done using `python3-pip-3.13` to `~/.local/bin/ansible`. A trivial example using just `assert` is:

```auto
- hosts: localhost
  gather_facts: false
  tasks:
  - assert:
      that: true | bool

```

which gives this result (but only if `| bool` is included):

```auto
[steve@trillian IaC]$ ansible-playbook tmp.yml

PLAY [localhost] **************************************************************************************************************************************************************************

TASK [assert] *****************************************************************************************************************************************************************************
Friday 06 February 2026 18:20:42 +0000 (0:00:00.030) 0:00:00.030 ******* 
[WARNING]: Deprecation warnings can be disabled by setting `deprecation_warnings=False` in ansible.cfg.
[DEPRECATION WARNING]: The `ansible.module_utils.common._collections_compat` module is deprecated. This feature will be removed from ansible-core version 2.24. Use `collections.abc` from the Python standard library instead.
ok: [localhost] => 
    changed: false
    msg: All assertions passed

PLAY RECAP ********************************************************************************************************************************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0   

TASKS RECAP *******************************************************************************************************************************************************************************
Friday 06 February 2026 18:20:43 +0000 (0:00:00.067) 0:00:00.098 ******* 
=============================================================================== 
assert ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 0.07s
[steve@trillian IaC]$

```

Ansible config:

```auto
[steve@trillian IaC]$ ansible --version
ansible [core 2.20.2]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/steve/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/steve/.local/lib/python3.13/site-packages/ansible
  ansible collection location = /home/steve/.ansible/collections:/usr/local/share/ansible/collections:/usr/share/ansible/collections
  executable location = /home/steve/.local/bin/ansible
  python version = 3.13.11 (main, Dec 5 2025, 00:00:00) [GCC 11.5.0 20240719 (Red Hat 11.5.0-11)] (/usr/bin/python3.13)
  jinja version = 3.1.6
  pyyaml version = 6.0.3 (with libyaml v0.2.5)
[steve@trillian IaC]$ 

```

O/S

```auto
[steve@trillian IaC]$ cat /etc/redhat-release 
AlmaLinux release 9.7 (Moss Jungle Cat)
[steve@trillian IaC]$

```

Installed collections:

```auto
[steve@trillian IaC]$ ansible-galaxy collection list

# /usr/local/share/ansible/collections/ansible_collections
Collection Version
------------------------ -------
ansible.netcommon 8.4.0  
ansible.posix 2.1.0  
ansible.utils 6.0.1  
awx.awx 24.6.1 
chocolatey.chocolatey 1.5.3  
community.crypto 3.1.0  
community.dns 3.5.1  
community.docker 5.0.5  
community.general 12.3.0 
community.libvirt 2.0.0  
community.okd 5.0.0  
containers.podman 1.19.0 
infra.aap_utilities 2.8.0  
infra.leapp 1.6.1  
kubernetes.core 5.0.0  
oxlorg.opnsense 25.7.8 
redhat.openshift 4.0.1  

# /usr/share/ansible/collections/ansible_collections
Collection Version
------------------------ -------
redhat.rhel_mgmt 1.1.0  
redhat.rhel_system_roles 1.108.6
[steve@trillian IaC]$ 

```

---

<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:** [February 6, 2026, 7:49pm UTC](https://forum.ansible.com/t/deprecation-warnings-with-ansible-core-2-20-2/45286/2 "2026-02-06T19:49:49Z")

</div>

I don’t get this with a pristine ansible-core 2.20.2 installation, so I guess this is related to at least one of your installed collections.

You could use the [Ansible Configuration Settings — Ansible Community Documentation](https://docs.ansible.com/projects/ansible/latest/reference_appendices/config.html#display-traceback) setting to figure out what exactly is causing this, for example by running `ANSIBLE_DISPLAY_TRACEBACK=deprecated ansible-playbook tmp.yml`. That should hopefully show where the deprecation comes from.

---

<div class="post-metadata">

**Author:** ![tsgsh](https://avatars.discourse-cdn.com/v4/letter/t/a8b319/32.png) [@tsgsh](https://forum.ansible.com/u/tsgsh)\
**Post date:** [February 6, 2026, 8:18pm UTC](https://forum.ansible.com/t/deprecation-warnings-with-ansible-core-2-20-2/45286/3 "2026-02-06T20:18:50Z")

</div>

Thanks @felixfontein: it’s ansible.utils

```auto
  File "/usr/local/share/ansible/collections/ansible_collections/ansible/utils/plugins/module_utils/common/utils.py", line 13, in <module>
    from ansible.module_utils.common._collections_compat import Mapping
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1023, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/steve/.local/lib/python3.13/site-packages/ansible/module_utils/common/_collections_compat.py", line 32, in <module>
    _warnings.deprecate(
Message: The `ansible.module_utils.common._collections_compat` module is deprecated.

```

I have 6.0.1 from December

```auto
[steve@trillian IaC]$ tail -n14 /usr/local/share/ansible/collections/ansible_collections/ansible/utils/changelogs/changelog.yaml 
  6.0.1:
    changes:
      bugfixes:
        - Add a cleanup step that removes empty {} and [] values from lists in keep_keys_from_dict_n_list()
      doc_changes:
        - Fix the description of the reduce_on_network filter.
        - Fix the module name in ipmath filter.
    fragments:
      - fix_data_tagging.yaml
      - fix_description.yaml
      - fix_keep_keys_list_retention.yaml
      - fix_module_name.yaml
      - fix_sanity.yaml
    release_date: "2025-12-31"
[steve@trillian IaC]$ 

```

---

<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:** [February 6, 2026, 8:26pm UTC](https://forum.ansible.com/t/deprecation-warnings-with-ansible-core-2-20-2/45286/4 "2026-02-06T20:26:11Z")

</div>

A related issue: [remove\_keys uses deprecated methods · Issue #421 · ansible-collections/ansible.utils · GitHub](https://github.com/ansible-collections/ansible.utils/issues/421)

(Maybe you have some config, inventory, … somewhere that uses a filter from the collection, and thus triggers the deprecation warning? I do have that collection installed as well, but I don’t get the deprecation with your playbook.)

---

<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:** [February 6, 2026, 8:48pm UTC](https://forum.ansible.com/t/deprecation-warnings-with-ansible-core-2-20-2/45286/5 "2026-02-06T20:48:34Z")

</div>

There’s also a PR which fixes these deprecations: [Fix several deprecations by olaf-mandel · Pull Request #423 · ansible-collections/ansible.utils · GitHub](https://github.com/ansible-collections/ansible.utils/pull/423)

---

<div class="post-metadata">

**Author:** ![tsgsh](https://avatars.discourse-cdn.com/v4/letter/t/a8b319/32.png) [@tsgsh](https://forum.ansible.com/u/tsgsh)\
**Post date:** [February 6, 2026, 10:40pm UTC](https://forum.ansible.com/t/deprecation-warnings-with-ansible-core-2-20-2/45286/6 "2026-02-06T22:40:07Z")

</div>

@felixfontein thanks for the help. Much appreciated.
