Merge 96aca32728
into d5d1d2e4dd
This commit is contained in:
commit
1e3d714c08
|
@ -44,6 +44,7 @@ jobs:
|
|||
- rockylinux9
|
||||
- rockylinux8
|
||||
- fedora39
|
||||
- ubuntu2404
|
||||
- ubuntu2204
|
||||
- ubuntu2004
|
||||
- debian12
|
||||
|
|
|
@ -20,6 +20,10 @@ The name of the package to install to get `pip` on the system. For older systems
|
|||
|
||||
The role will try to autodetect the pip executable based on the `pip_package` (e.g. `pip` for Python 2 and `pip3` for Python 3). You can also override this explicitly, e.g. `pip_executable: pip3.6`.
|
||||
|
||||
pip_externally_managed: true
|
||||
|
||||
Marking whether Python base environments should be "externally managed" or not.
|
||||
|
||||
pip_install_packages: []
|
||||
|
||||
A list of packages to install with pip. Examples below:
|
||||
|
|
|
@ -3,4 +3,5 @@
|
|||
pip_package: python3-pip
|
||||
pip_executable: "{{ 'pip3' if pip_package.startswith('python3') else 'pip' }}"
|
||||
|
||||
pip_externally_managed: true
|
||||
pip_install_packages: []
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
become: true
|
||||
|
||||
vars:
|
||||
pip_externally_managed: false
|
||||
pip_install_packages:
|
||||
# Test installing a specific version of a package.
|
||||
- name: ipaddress
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
---
|
||||
# Remove EXTERNALLY-MANAGED file if we're on Debian12
|
||||
# Related issue: https://github.com/geerlingguy/ansible-role-pip/issues/57
|
||||
- name: Get python3 version installed
|
||||
ansible.builtin.command: python3 --version
|
||||
register: py3ver
|
||||
changed_when: false
|
||||
|
||||
- name: Remove EXTERNALLY-MANAGED
|
||||
ansible.builtin.file:
|
||||
path: /usr/lib/python3.11/EXTERNALLY-MANAGED
|
||||
state: absent
|
||||
when: py3ver is defined and py3ver.stdout.find("3.11") != -1
|
|
@ -1,9 +1,16 @@
|
|||
---
|
||||
- name: Remove externally managed from Debian 12
|
||||
ansible.builtin.import_tasks: debian12.yml
|
||||
when:
|
||||
- ansible_distribution == "Debian"
|
||||
- ansible_distribution_major_version|int >= 12
|
||||
# Remove EXTERNALLY-MANAGED if pip_externally_managed is true and python3 version is 3.11 or higher.
|
||||
# Related issue: https://github.com/geerlingguy/ansible-role-pip/issues/57
|
||||
- name: Get installed python3 version
|
||||
ansible.builtin.shell: python3 --version | awk '{split($2, a, "."); print a[1] "." a[2]}'
|
||||
register: py3ver
|
||||
changed_when: false
|
||||
|
||||
- name: Ensure "{{ 'absent' if not pip_externally_managed else 'present' }}" of EXTERNALLY-MANAGED's Python base environments
|
||||
ansible.builtin.file:
|
||||
path: "/usr/lib/python{{ py3ver.stdout }}/EXTERNALLY-MANAGED"
|
||||
state: "{{ 'absent' if not pip_externally_managed else 'touch' }}"
|
||||
when: py3ver is defined and py3ver.stdout is version_compare('3.11', '>=')
|
||||
|
||||
- name: Ensure Pip is installed.
|
||||
package:
|
||||
|
|
Loading…
Reference in New Issue