ansible-keycloak icon indicating copy to clipboard operation
ansible-keycloak copied to clipboard

Conditional python version autodetection and task blocks

Open 3coma3 opened this issue 5 years ago • 1 comments

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_interpreter was previously set, assume it is the same interpreter whose current version is reported in ansible_python_version.

  • Whether autodetection is done or not, a dedicated variable python_major_version is set to either "2" or "3", and all operations that depend on the python version are done evaluating that variable. This includes setting ansible_python_interpreter when 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-.

3coma3 avatar Aug 08 '20 16:08 3coma3

Note that the loop in main.yml still contains pyOpenSSL on its list, so that needs correction. But submitting anyway for review.

3coma3 avatar Aug 08 '20 16:08 3coma3