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.
In the role's current format it sets
ansible_python_interpreter
tonetbox_python_binary
before executing any tasks, however it does not return it to the original value when the role completes. This can cause issues with subsequently executing modules such as yum, that require a python2 interpreter.This can be resolved by the enduser by setting
ansible_python_interpreter
to the desired binary(assuming he knows it) after aninclude_role
orimport_role
task before moving on to the next task/role but obviously this is not desirable. More importantly it does not solve for calling roles the old fashioned way such as this:Capturing the initial value of
ansible_python_interpreter
on load and resetting it to something similar when we are done is the best way I can think of to deal with this, because you can't undefine a variable the best solution is to set it to theauto_legacy
value as described here: https://docs.ansible.com/ansible/latest/reference_appendices/interpreter_discovery.htmlOne thing I didn't account for was if the role exits with an error the variable will not be reset, but I don't know why you would want to run subsequent tasks/roles after a failed install, so does it matter?