Skip to content
Snippets Groups Projects
Commit 63fd53eb authored by Thomas Woerner's avatar Thomas Woerner
Browse files

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.
parent 07a831a3
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,10 @@
state: present
with_items: "{{ ipaclient_packages }}"
- name: Install - Include Python2/3 import test
include: "{{role_path}}/tasks/python_2_3_test.yml"
static: yes
- name: Install - IPA discovery
ipadiscovery:
domain: "{{ ipaclient_domain | default(omit) }}"
......
- 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
---
# tasks to uninstall IPA client
- name: Uninstall - Include Python2/3 import test
include: "{{role_path}}/tasks/python_2_3_test.yml"
static: yes
- name: Uninstall - Uninstall IPA client
ipaclient:
state: absent
......
ipaclient_packages: [ "ipa-client", "libselinux-python" ]
ansible_python_interpreter: '/usr/bin/python2'
\ No newline at end of file
#ansible_python_interpreter: '/usr/bin/python2'
\ No newline at end of file
ipaclient_packages: [ "ipa-client", "libselinux-python" ]
ansible_python_interpreter: '/usr/bin/python2'
\ No newline at end of file
#ansible_python_interpreter: '/usr/bin/python2'
\ No newline at end of file
# defaults file for ipaclient
# vars/rhel.yml
ipaclient_packages: [ "ipa-client", "ipa-admintools", "libselinux-python" ]
ansible_python_interpreter: '/usr/bin/python2'
#ansible_python_interpreter: '/usr/bin/python2'
# defaults file for ipaclient
# vars/rhel.yml
ipaclient_packages: [ "ipa-client", "libselinux-python" ]
ansible_python_interpreter: '/usr/bin/python2'
#ansible_python_interpreter: '/usr/bin/python2'
# defaults file for ipaclient
# vars/default.yml
ipaclient_packages: [ "ipa-client", "libselinux-python" ]
ansible_python_interpreter: '/usr/bin/python3'
#ansible_python_interpreter: '/usr/bin/python3'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment