File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
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 }}"
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"
You can’t perform that action at this time.
0 commit comments