Skip to content

Commit 0ed6755

Browse files
committed
handle 24.04 and beyond(?)
1 parent 3fc8d39 commit 0ed6755

File tree

3 files changed

+46
-15
lines changed

3 files changed

+46
-15
lines changed

tasks/package.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
state: "absent"
1919
when: python_packages_remove|default([])|length > 0
2020

21-
- name: "install additional python versions, if requested"
21+
- name: "install additional (legacy) python versions, if requested"
2222
apt:
2323
pkg:
2424
- "python{{item}}"
@@ -27,3 +27,14 @@
2727
- "python{{item}}-venv"
2828
state: "latest"
2929
with_items: "{{python_versions}}"
30+
when: item|float < 3.12
31+
32+
- name: "install additional python versions, if requested"
33+
apt:
34+
pkg:
35+
- "python{{item}}"
36+
- "python{{item}}-dev"
37+
- "python{{item}}-venv"
38+
state: "latest"
39+
with_items: "{{python_versions}}"
40+
when: item|float >= 3.12

tasks/pip.yml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
---
2-
- name: "Fetch the pip install script"
3-
get_url:
4-
dest: "/tmp/get-pip.py"
5-
url: "{{get_pip_url}}"
6-
7-
- name: "install pip"
8-
command: python3 /tmp/get-pip.py
9-
args:
10-
creates: "{{python_pip_location}}"
11-
12-
- name: "update setuptools"
13-
pip:
14-
name: "setuptools{% if python_setuptools_version is defined %}=={{python_setuptools_version}}{% endif %}"
15-
state: present
2+
- name: "install pip the old way"
3+
block:
4+
- name: "Fetch the pip install script"
5+
get_url:
6+
dest: "/tmp/get-pip.py"
7+
url: "{{get_pip_url}}"
8+
9+
- name: "install pip"
10+
command: python3 /tmp/get-pip.py
11+
args:
12+
creates: "{{python_pip_location}}"
13+
14+
- name: "update setuptools"
15+
pip:
16+
name: "setuptools{% if python_setuptools_version is defined %}=={{python_setuptools_version}}{% endif %}"
17+
state: present
18+
19+
when: ansible_lsb.id == "Ubuntu" and ansible_lsb.major_release|int < 20
20+
21+
- name: "install pip the new way"
22+
apt:
23+
pkg: "python3-pip"
24+
state: "latest"
25+
when: ansible_lsb.id == "Ubuntu" and ansible_lsb.major_release|int >= 20

vars/ubuntu-24.04.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
python_packages_add:
3+
- "python3"
4+
- "python3-dev"
5+
- "python3-venv"
6+
- "virtualenv"
7+
8+
python_packages_remove:
9+
- "python2.7"
10+
- "python2.7-dev"

0 commit comments

Comments
 (0)