Skip to content

Update interpreter_discovery for changes made in ansible-core 2.17 #2438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 12 additions & 32 deletions docs/docsite/rst/reference_appendices/interpreter_discovery.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,19 @@ To control the discovery behavior:
* for individual hosts and groups, use the ``ansible_python_interpreter`` inventory variable
* globally, use the ``interpreter_python`` key in the ``[defaults]`` section of ``ansible.cfg``

Use one of the following values:
Configure a path to a specific Python interpreter, or one of the following values:

auto (default) :
Searches the configurable list of common Python interpreter paths
(see :ref:`INTERPRETER_PYTHON_FALLBACK`) and issues a warning that
future installation of another Python interpreter could alter the one chosen.

auto_legacy :
Detects the target OS platform, distribution, and version, then consults a
table listing the correct Python interpreter and path for each
platform/distribution/version. If an entry is found, and ``/usr/bin/python`` is absent, uses the discovered interpreter (and path). If an entry
is found, and ``/usr/bin/python`` is present, uses ``/usr/bin/python``
and 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/python`` on 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 : (default in 2.12)
Detects the target OS platform, distribution, and version, then consults a
table listing the correct Python interpreter and path for each
platform/distribution/version. If an entry is found, uses the discovered
interpreter.
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_silent
Same as ``auto_legacy``, but does not issue warnings.

auto_silent
Deprecated alias for ``auto``.

auto_silent :
Same as ``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, and so on).
Setting a specific path completely disables automatic interpreter discovery; Ansible always uses the path specified.
auto_legacy_silent :
Deprecated alias for ``auto_silent``.