Ansible DEPCRYCATED WARNING
Log Warning:
[DEPRECATION WARNING]: Distribution redhat 8.6 on host 10.23.21.35 should use /usr/libexec/platform-python, but is using /usr/bin/python for backward compatibility with prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See https://docs.ansible.com/ansibl/2.9/reference_appendices/interpreter_discovery.html for more information. This feature will be removed in version 2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
Solution :
To use /usr/libexec/platform-python as the interpreter in Ansible 2.9.27 on a Red Hat system, you can specify it explicitly in your Ansible playbook or inventory.
In your playbook, you can set the ansible_python_interpreter variable to /usr/libexec/platform-python in the vars section or at the task level like this:
ansible.cfg
[defaults] interpreter_python = /usr/libexec/platform-python
yaml:
- hosts: myhost vars: ansible_python_interpreter: /usr/libexec/platform-python tasks: - name: Install a package yum: name: mypackage state: present
Alternatively, you can set the ansible_python_interpreter variable in your inventory file like this:
hosts:
[myhost] 10.23.21.32 ansible_python_interpreter=/usr/libexec/platform-python
This will set the interpreter for the myhost host to /usr/libexec/platform-python.
Note that if you have multiple hosts that require /usr/libexec/platform-python as the interpreter, it’s a good idea to use a group variable instead of specifying the interpreter for each host individually. You can set the ansible_python_interpreter variable in a group_vars file like this:
# group_vars/mygroup.yml ansible_python_interpreter: /usr/libexec/platform-python
Then, in your inventory file, you can assign hosts to the group like this:
[mygroup] host1 host2
This will set the interpreter for all hosts in the mygroup group to /usr/libexec/platform-python.