mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-06-23 09:14:43 +00:00
Use Python2/3 to detect ansible_python_interpreter
With the test it is not needed to pin down the python interpreter for ansible modules. It is therefore possible to use a Python2 version on Fedora-27 and a Python3 version on Fedora-26.
This commit is contained in:
15
roles/ipaclient/tasks/python_2_3_test.yml
Normal file
15
roles/ipaclient/tasks/python_2_3_test.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
- block:
|
||||
- name: Verify Python3 import
|
||||
command: python3 -c "from ipapython.version import NUM_VERSION"
|
||||
register: py3test
|
||||
failed_when: False
|
||||
|
||||
- name: Set python interpreter to 3
|
||||
set_fact:
|
||||
ansible_python_interpreter: "/usr/bin/python3"
|
||||
when: py3test.rc == 0
|
||||
|
||||
- name: Set python interpreter to 2
|
||||
set_fact:
|
||||
ansible_python_interpreter: "/usr/bin/python2"
|
||||
when: py3test.failed or py3test.rc != 0
|
||||
Reference in New Issue
Block a user