[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
This commit is contained in:
Szymon Datko 2022-02-16 13:45:17 +01:00
parent e3b7e0dcf6
commit 272f091cf9

View File

@ -23,10 +23,21 @@
- name: Install specified version of python interpreter and development files (RPM) - name: Install specified version of python interpreter and development files (RPM)
when: when:
- ansible_distribution == 'CentOS' or ansible_distribution == 'RedHat' - ansible_distribution == 'CentOS' or ansible_distribution == 'RedHat'
package: block:
name: python{{ python_version | replace('.', '') }}-devel - name: Set default RPM package name
state: present set_fact:
become: yes 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 - name: Install python using pyenv
when: when: