Merge pull request #69 from ShaneMcC/issue-66

Fix for externally-managed python on later ubuntu/debian installs.
This commit is contained in:
Jeff Geerling 2024-11-10 21:05:11 -06:00 committed by GitHub
commit 5b1f472d72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 19 deletions

View File

@ -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

View File

@ -1,15 +1,14 @@
---
- name: Remove externally managed from Debian 12
ansible.builtin.import_tasks: debian12.yml
when:
- ansible_distribution == "Debian"
- ansible_distribution_major_version|int >= 12
- name: Ensure Pip is installed.
package:
name: "{{ pip_package }}"
state: present
- name: Remove EXTERNALLY-MANAGED
ansible.builtin.file:
path: /usr/lib/python3.{{ ansible_python.version.minor }}/EXTERNALLY-MANAGED
state: absent
- name: Ensure pip_install_packages are installed.
pip:
name: "{{ item.name | default(item) }}"