From 272f091cf98cec0017c8c0305d48319b66381d9f Mon Sep 17 00:00:00 2001 From: Szymon Datko Date: Wed, 16 Feb 2022 13:45:17 +0100 Subject: [PATCH] [ensure-python] Fix for CentOS/RHEL 9 packages This commit introduces a conditional for RPM package name when running on a recent CentOS/RHEL system. Change-Id: I716cc97a8dace02c874d2e39dc90d6a42808ebf6 --- roles/ensure-python/tasks/main.yaml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/roles/ensure-python/tasks/main.yaml b/roles/ensure-python/tasks/main.yaml index b7b153a3b..bf958d436 100644 --- a/roles/ensure-python/tasks/main.yaml +++ b/roles/ensure-python/tasks/main.yaml @@ -23,10 +23,21 @@ - name: Install specified version of python interpreter and development files (RPM) when: - ansible_distribution == 'CentOS' or ansible_distribution == 'RedHat' - package: - name: python{{ python_version | replace('.', '') }}-devel - state: present - become: yes + block: + - name: Set default RPM package name + set_fact: + rpm_python_pkg_name: python{{ python_version | replace('.', '') }}-devel + - name: Set RPM package name for CentOS/RHEL 9 and Python 3.9 + set_fact: + rpm_python_pkg_name: python3-devel + when: + - ansible_distribution_major_version == '9' + - python_version == '3.9' + - name: Install RPM package + package: + name: "{{ rpm_python_pkg_name }}" + state: present + become: yes - name: Install python using pyenv when: