|
50 | 50 |
|
51 | 51 | # Distro-packaged pipx can be outdated (Ubuntu 24.04 has 1.4.3). |
52 | 52 | # community.general.pipx requires >= 1.7.0 for application parameter. |
53 | | -# Upgrade pip and pipx system-wide - overwrites older distro versions in-place. |
| 53 | +# Upgrade pip and pipx system-wide - installs alongside distro versions. |
54 | 54 | # --break-system-packages required on Ubuntu 24.04+ (PEP 668 protection). |
| 55 | +# --ignore-installed avoids "Cannot uninstall pip, RECORD file not found" error. |
55 | 56 | - name: Upgrade pip to latest (system-wide) |
| 57 | + ansible.builtin.command: |
| 58 | + cmd: python3 -m pip install --upgrade --break-system-packages --ignore-installed pip |
| 59 | + become: true |
| 60 | + when: ansible_facts['distribution'] == 'Ubuntu' |
| 61 | + changed_when: true |
| 62 | + |
| 63 | +- name: Upgrade pip to latest (Fedora) |
56 | 64 | ansible.builtin.pip: |
57 | 65 | name: pip |
58 | 66 | state: latest |
59 | | - extra_args: "{{ '--break-system-packages' if ansible_facts['distribution'] == 'Ubuntu' else omit }}" |
60 | 67 | become: true |
61 | | - when: ansible_facts['distribution'] in ['Ubuntu', 'Fedora'] |
| 68 | + when: ansible_facts['distribution'] == 'Fedora' |
62 | 69 |
|
63 | 70 | - name: Upgrade pipx to latest (system-wide) |
| 71 | + ansible.builtin.command: |
| 72 | + cmd: python3 -m pip install --upgrade --break-system-packages --ignore-installed pipx |
| 73 | + become: true |
| 74 | + when: ansible_facts['distribution'] == 'Ubuntu' |
| 75 | + changed_when: true |
| 76 | + |
| 77 | +- name: Upgrade pipx to latest (Fedora) |
64 | 78 | ansible.builtin.pip: |
65 | 79 | name: pipx |
66 | 80 | state: latest |
67 | | - extra_args: "{{ '--break-system-packages' if ansible_facts['distribution'] == 'Ubuntu' else omit }}" |
68 | 81 | become: true |
69 | | - when: ansible_facts['distribution'] in ['Ubuntu', 'Fedora'] |
| 82 | + when: ansible_facts['distribution'] == 'Fedora' |
70 | 83 |
|
71 | 84 | - name: Install gnome-extensions-cli via pipx |
72 | 85 | community.general.pipx: |
|
0 commit comments