Thanks for your help and detailed explanation on the Python interpreter 
selection in Ansible. 

After our discussion, I confirmed that I can achieve my initial goal 
(prioritizing '/usr/bin/python3' when both '/usr/bin/python3' and 
'/usr/bin/python' are present, and automatically detecting other Python 
interpreters when '/usr/bin/python3' is not available) by adjusting the 
INTERPRETER_PYTHON setting.

Initially, I faced issues with the default behavior prioritizing 
'/usr/bin/python' when both were present. My environment is using Ansible 
2.10, which sets INTERPRETER_PYTHON to 'auto_legacy' by default. Based on 
your advice, I found that changing INTERPRETER_PYTHON to 'auto' or 
'auto_silent' resolved the issue in a straightforward manner.

I appreciate your assistance in resolving this problem. 

Best regards,

Haji

2023年4月29日土曜日 19:00:57 UTC+9 Vladimir Botka:

> On Sat, 29 Apr 2023 00:56:33 -0700 (PDT)
> Haji Hogson <[email protected]> wrote:
>
> > automatically discover the ... appropriate Python interpreter ...
> > /usr/bin/python3 if available ... and fall back to automatic
> > discovery otherwise.
>
> See the configuration parameter INTERPRETER_PYTHON_FALLBACK
>
> https://docs.ansible.com/ansible/latest/reference_appendices/config.html#interpreter-python-fallback
>
> You can put it into the inventory file
> ansible_interpreter_python_fallback=['/usr/bin/python3','/usr/bin/python']
>
> See also the configuration parameter INTERPRETER_PYTHON
>
> https://docs.ansible.com/ansible/latest/reference_appendices/config.html#interpreter-python
>
> The fallback will be used if INTERPRETER_PYTHON is not available.
> "The fallback behavior will issue a warning that the interpreter
> should be set explicitly..." You can chose a discovery mode (default
> auto).
>
>
> -- 
> Vladimir Botka
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e23d9aaa-65f2-4102-9bf2-c08c4906244bn%40googlegroups.com.

Reply via email to