From 85b68da8c26e7efeb5effc3953db64fdca363e5f Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Wed, 8 Feb 2023 18:18:19 +0000 Subject: [PATCH] Add task file for checking default python version --- molecule/default/converge.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 8131e2d..6f6a1c6 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -8,13 +8,13 @@ - "!min" - "!all" pre_tasks: - - name: Set Python install version to 2 for older OSes + - name: Check the major Python version for the OS + ansible.builtin.include_role: + name: "mirsg.install_python" + tasks_from: "check_default_version" + - name: Set install_python variable based on the version to be installed ansible.builtin.set_fact: - install_python: "{{ install_python2 }}" - when: > - (ansible_os_family == 'RedHat') and (ansible_distribution_major_version | int < 8) or - (ansible_distribution == 'Debian') and (ansible_distribution_major_version | int < 10) or - (ansible_distribution == 'Ubuntu') and (ansible_distribution_major_version | int < 18) + install_python: "{{ 'install_python2' if default_python_version is version('2') else 'install_python3' }}" tasks: - name: Install Python, pip, and setuptools ansible.builtin.include_role: