

You can set it to auto, which will be default in the future, so it will work oppositely. Since Ansible 2.8, the default value ansible_python_interpreter is auto_legacy, which means that it will prefer /usr/bin/python (if it exists) over the discovered Python version. Name: Ordered list of Python interpreters to check for in discovery # FUTURE: add a platform layer to the map so we could use for, eg, freebsd/macos/etc? # FUTURE: add inventory override once we're sure it can't be abused by a rogue target Name: Mapping of known included platform pythons for various Linux distros That always defaulted to ``/usr/bin/python``, will use that interpreter if present (and issue a warning that theĭefault behavior will change to that of ``auto`` in a future Ansible release. Value of ``auto_legacy`` provides all the same behavior, but for backwards-compatibility with older Ansible releases This warning behavior can be disabled by setting ``auto_silent``. Theįallback behavior will issue a warning that the interpreter should be set explicitly (since interpreters installed All discovery modesĮmploy a lookup table to use the included system Python (on distributions known to include one), falling back to aįixed ordered list of well-known Python interpreter locations if a platform-specific default is not available. Supported discovery modes are ``auto``, ``auto_silent``, and ``auto_legacy`` (the default). Path to the Python interpreter to be used for module execution on remote targets, or an automatic discovery mode.

Name: Python interpreter path (or automatic discovery behavior) used for module executionĮnv: [ This change will go live in Ansible 2.10. I am using Ansible 2.9.2 with a modification applied to INTERPRETER_PYTHON_DISTRO_MAP map (to support Debian 10) in lib/ansible/config/base.yml file from Default to python3 on Debian 10 #63097 merge request. hosts: python_interpreter_test_default, python_interpreter_test_defined Sample python_interpreter_test_playbook.yml Ansible playbook file.

Īnsible_python_interpreter: /usr/bin/python3Īnsible_python_interpreter: /usr/bin/python2 Sample python_interpreter_test_inventory.yml Ansible inventory file. Lrwxrwxrwx 1 root root 14 /usr/bin/python-config -> python2-config Lrwxrwxrwx 1 root root 10 /usr/bin/python3m -> python3.7m Lrwxrwxrwx 1 root root 9 /usr/bin/python3 -> python3.7 Lrwxrwxrwx 1 root root 16 /usr/bin/python2-config -> python2.7-config Lrwxrwxrwx 1 root root 33 Oct 10 22:02 /usr/bin/python2.7-config -> x86_64-linux-gnu-python2.7-config Lrwxrwxrwx 1 root root 9 /usr/bin/python2 -> python2.7 Lrwxrwxrwx 1 root root 7 /usr/bin/python -> python2 Python interpreters on the remote system. $ lsb_release -aĭescription: Debian GNU/Linux 10 (buster) Instruct Ansible to use a specific version of Python interpreter on the remote host.
