ansible-keycloak
ansible-keycloak copied to clipboard
Conditional python version autodetection and task blocks
There are two changes in this patch:
1- have the python autodetection via import to happen only when ansible_python_interpreter is undefined at the time of role application. Autodetection itself works exactly as before, setting ansible_python_interpreter according to the py3test.py test.
-
When
ansible_python_interpreterwas previously set, assume it is the same interpreter whose current version is reported inansible_python_version. -
Whether autodetection is done or not, a dedicated variable
python_major_versionis set to either "2" or "3", and all operations that depend on the python version are done evaluating that variable. This includes settingansible_python_interpreterwhen autodetected.
This change solves #28
2- add the python dependencies in a list (currently there's only one anyway), so they are added deterministically to the processing loop at main.yml.
This change is optional and partially unrelated, so it can go in another PR or remain unmerged, it doesn't affect 1-.
Note that the loop in main.yml still contains pyOpenSSL on its list, so that needs correction. But submitting anyway for review.