Most Ansible modules that execute under a POSIX environment require a Python interpreter on the target host. Unless configured otherwise, Ansible will attempt to discover a suitable Python interpreter on each target host the first time a Python module is executed for that host.
To control the discovery behavior:
interpreter_pythonkey in the
Use one of the following values:
/usr/bin/pythonis absent, uses the discovered interpreter (and path). If an entry is found, and
/usr/bin/pythonis present, uses
/usr/bin/pythonand issues a warning. This exception provides temporary compatibility with previous versions of Ansible that always defaulted to
/usr/bin/python, so if you have installed Python and other dependencies at
usr/bin/pythonon some hosts, Ansible will find and use them with this setting. If no entry is found, or the listed Python is not present on the target host, searches a list of common Python interpreter paths and uses the first one found; also issues a warning that future installation of another Python interpreter could alter the one chosen.
auto_legacy, but does not issue warnings.
auto, but does not issue warnings.
You can still set
ansible_python_interpreter to a specific path at any
variable level (for example, in host_vars, in vars files, in playbooks, etc.).
Setting a specific path completely disables automatic interpreter discovery; Ansible always uses the path specified.