Skip to content

Deprecation warning on Set option hidepid for proc filesystem regarding to_bytes and to_native #936

@DBX12

Description

@DBX12

Description

Running the devsec.hardening.os_hardening role with default configuration makes ansible emit some deprecation warnings:

TASK [devsec.hardening.os_hardening : Set option hidepid for proc filesystem] *************************************************************************************************************************************
[WARNING]: Deprecation warnings can be disabled by setting `deprecation_warnings=False` in ansible.cfg.
[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_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.
[DEPRECATION WARNING]: Passing `warnings` to `exit_json` or `fail_json` is deprecated. This feature will be removed from ansible-core version 2.23. Use `AnsibleModule.warn` instead.
changed: [default]

Reproduction steps

- name: my-playbook
  hosts: my-hosts
  roles:
    - role: devsec.hardening.os_hardening

Current Behavior

Role is using deprecated functionality which is scheduled to be removed

Expected Behavior

Role uses the suggested replacements before the deprecated functionality is removed from ansible

OS / Environment

Omitted as irrelevant and to reduce noise, but will add when asked.

Ansible Version

ansible [core 2.20.3]
  config file = /home/dbx12/projects/server-provisioning/ansible.cfg
  configured module search path = ['/home/dbx12/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/dbx12/.local/share/virtualenvs/server-provisioning-ZJ16AGwc/lib/python3.12/site-packages/ansible
  ansible collection location = /home/dbx12/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/dbx12/.local/share/virtualenvs/server-provisioning-ZJ16AGwc/bin/ansible
  python version = 3.12.3 (main, Jan 22 2026, 20:57:42) [GCC 13.3.0] (/home/dbx12/.local/share/virtualenvs/server-provisioning-ZJ16AGwc/bin/python)
  jinja version = 3.1.6
  pyyaml version = 6.0.3 (with libyaml v0.2.5)

Collection Version

collections:
  - name: devsec.hardening
    version: 10.5.0

Additional information

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