Set default Ansible Python interpreter#1665
Open
retlehs wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Sets Trellis' default Ansible Python interpreter to the stable Ubuntu system Python path:
This avoids Ansible interpreter discovery warnings during provisioning while keeping the value in project vars, where projects can still override it per environment or host if needed.
Current warning
Without an explicit interpreter, Ansible can emit this during provision:
Related issues
server.ymlinterpreter setup because Trellis still installed Python 2-specific packages on servers at the time.python_interpreterrole was removed. The issue mentionsinterpreter_python = /usr/bin/python3and per-hostansible_python_interpreter=/usr/bin/python3as workarounds, and was closed after #1373 allowed newer Ansible versions with improved interpreter discovery./usr/bin/python3.8; the reporter confirmed that addingansible_python_interpreter=/usr/bin/python3to the host fixed it.Related PR history
python3 || pythonand setansible_python_interpreterfrom the discovered path.server.ymlinterpreter setup because Python 2-specific remote packages still made Python 3 unsafe on some supported servers.Python version compatibility): added aserver.ymltask that setansible_python_interpreter: python3for Ubuntu 18.04/Bionic hosts.Set ansible_python_interpreter in dev): reintroduced interpreter handling through apython_interpreterrole and added it to development provisioning.>= 18.04version check.ansible_localVagrant provisioner" (Vagrant: use python3): set Vagrant'sansible_python_interpreterdefault to/usr/bin/python3.python_interpreterrole and its plays because Python 3 became a Trellis requirement.ansible_python_interpreter=/usr/bin/python3in the CI inventory so local CI runs use system Python where apt-installed Python packages are available.