Skip to content

Ansible 13 / ansible-core 2.20 new deprecation warnings #896

@sibebleuze

Description

@sibebleuze
SUMMARY

Once I upgraded my Ansible to version 13.0 (with ansible-core 2.20), I got some deprecation warnings from community.postgresql tasks that weren't there before.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME
  • community.postgresql.postgresql_info
  • community.postgresql.postgresql_user
  • possibly others
ADDITIONAL INFORMATION

I believe the deprecation warnings to be coming from code in the community.postgresql collection rather than from (task/playbook) configuration on my side.
If I am mistaken, please do correct me (and if possible help me fix it).
If not, this porting guide may help fix the warnings: https://docs.ansible.com/projects/ansible/latest/porting_guides/porting_guide_13.html

Task with community.postgresql.postgresql_info:

- name: Get PostgreSQL version and settings
  community.postgresql.postgresql_info:
    filter: "version,settings"
    login_db: "postgres"
    ssl_mode: "disable"
  register: pg_info
  become: true
  become_user: postgres

Outcome: as expected, but with the following deprecation warning:

[DEPRECATION WARNING]: Importing 'to_native' from 'ansible.module_utils._text' is deprecated. This feature will be removed from ansible-core version 2.24. Use ansible.module_utils.common.text.converters instead.

Task with community.postgresql.postgresql_user:

- name: Create user with superuser privileges
  community.postgresql.postgresql_user:
    login_db: "postgres"
    role_attr_flags: "SUPERUSER"
    state: "present"
    name: "{{ postgres_username }}"
    password: "{{ postgres_password }}"
  become: true
  become_user: postgres

Outcome: as expected, but with the following deprecation warnings:

[DEPRECATION WARNING]: Importing 'to_bytes' from 'ansible.module_utils._text' is deprecated. This feature will be removed from ansible-core version 2.24. Use ansible.module_utils.common.text.converters instead.
[DEPRECATION WARNING]: Importing 'to_text' from 'ansible.module_utils._text' is deprecated. This feature will be removed from ansible-core version 2.24. Use ansible.module_utils.common.text.converters instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions