Skip to content

Commit 5673040

Browse files
feat: fix/update-redhat-venv
1 parent 41b5df4 commit 5673040

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

tasks/python-modules.yaml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
---
22
- name: Detect Python version
33
command: "{{ python_bin }} -c 'import sys; print(\"{}.{}\".format(sys.version_info[0], sys.version_info[1]))'"
44
register: python_version_output
@@ -8,12 +8,21 @@
88
set_fact:
99
python_version: "{{ python_version_output.stdout }}"
1010

11-
- name: Ensure Python venv and dev packages are installed
11+
- name: Ensure Python venv and dev packages are installed (Debian/Ubuntu)
1212
package:
1313
name:
1414
- "python{{ python_version }}-venv"
1515
- "python{{ python_version }}-dev"
1616
state: present
17+
when: ansible_os_family == 'Debian'
18+
19+
- name: Ensure Python venv and dev packages are installed (RedHat/Fedora)
20+
package:
21+
name:
22+
- python3-devel
23+
- python3-pip
24+
state: present
25+
when: ansible_os_family == 'RedHat'
1726

1827
- name: Create virtual environment
1928
command: "{{ python_bin }} -m venv {{ venv_path }}"
@@ -27,9 +36,10 @@
2736
creates: "{{ venv_path }}/bin/pip"
2837
become: true
2938

30-
- name: Upgrade pip and setuptools to avoid Python 3.12 issues
39+
- name: Upgrade pip and setuptools to avoid Python 3.12+ issues
3140
command: "{{ venv_path }}/bin/pip install --upgrade pip setuptools"
3241
become: true
42+
changed_when: false
3343

3444
- name: Check pip version
3545
command: "{{ venv_path }}/bin/pip --version"

0 commit comments

Comments
 (0)