Skip to content

Commit 4fc9003

Browse files
committed
chore: reorganize code
Split `tasks/main.yml` into several files so adding a new python version is as simple as going to `tasks/python3x.yml` and scrolling all the way down.
1 parent 884e263 commit 4fc9003

File tree

4 files changed

+137
-125
lines changed

4 files changed

+137
-125
lines changed

tasks/main.yml

Lines changed: 6 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -3,133 +3,14 @@
33
- name: Install dependencies
44
ansible.builtin.import_tasks: deps.yml
55

6-
- name: Install Python 2.4
7-
ansible.builtin.import_tasks: python24.yml
6+
- name: Install Python 2.x
7+
ansible.builtin.import_tasks: python2x.yml
88

9-
- name: Install Python 2.6
10-
ansible.builtin.import_tasks: python26.yml
9+
- name: Install Python 3.x
10+
ansible.builtin.import_tasks: python3x.yml
1111

12-
- name: Install Python 2.7
13-
ansible.builtin.include_tasks:
14-
file: python_generic.yml
15-
vars:
16-
py_data: "{{ py27 }}"
17-
when: python_27
18-
19-
- name: Install Python 3.1
20-
ansible.builtin.include_tasks:
21-
file: python_generic.yml
22-
vars:
23-
py_data: "{{ py31 }}"
24-
when: python_31
25-
26-
- name: Install Python 3.2
27-
ansible.builtin.include_tasks:
28-
file: python_generic.yml
29-
vars:
30-
py_data: "{{ py32 }}"
31-
when: python_32
32-
33-
- name: Install Python 3.3
34-
ansible.builtin.include_tasks:
35-
file: python_generic.yml
36-
vars:
37-
py_data: "{{ py33 }}"
38-
when: python_33
39-
40-
- name: Install Python 3.4
41-
ansible.builtin.include_tasks:
42-
file: python_generic.yml
43-
vars:
44-
py_data: "{{ py34 }}"
45-
when: python_34
46-
47-
- name: Install Python 3.5
48-
ansible.builtin.include_tasks:
49-
file: python_generic.yml
50-
vars:
51-
py_data: "{{ py35 }}"
52-
when: python_35
53-
54-
- name: Install Python 3.6
55-
ansible.builtin.include_tasks:
56-
file: python_generic.yml
57-
vars:
58-
py_data: "{{ py36 }}"
59-
when: python_36
60-
61-
- name: Install Python 3.7
62-
ansible.builtin.include_tasks:
63-
file: python_generic.yml
64-
vars:
65-
py_data: "{{ py37 }}"
66-
when: python_37
67-
68-
- name: Install Python 3.8
69-
ansible.builtin.include_tasks:
70-
file: python_generic.yml
71-
vars:
72-
py_data: "{{ py38 }}"
73-
when: python_38
74-
75-
- name: Install Python 3.9
76-
ansible.builtin.include_tasks:
77-
file: python_generic.yml
78-
vars:
79-
py_data: "{{ py39 }}"
80-
when: python_39
81-
82-
- name: Install Python 3.10
83-
ansible.builtin.include_tasks:
84-
file: python_generic.yml
85-
vars:
86-
py_data: "{{ py310 }}"
87-
when: python_310
88-
89-
- name: Install Python 3.11
90-
ansible.builtin.include_tasks:
91-
file: python_generic.yml
92-
vars:
93-
py_data: "{{ py311 }}"
94-
when: python_311
95-
96-
- name: Install Python 3.12
97-
ansible.builtin.include_tasks:
98-
file: python_generic.yml
99-
vars:
100-
py_data: py312
101-
when: python_312
102-
103-
- name: Install Python 3.13
104-
ansible.builtin.include_tasks:
105-
file: python_generic.yml
106-
vars:
107-
py_data: py313
108-
when: python_313
109-
110-
- name: Install Virtualenv for Python 2.4
111-
ansible.builtin.include_tasks:
112-
file: venv.yml
113-
vars:
114-
py_data: py24
115-
venv_data: venv24
116-
when: python_24
117-
118-
- name: Install Virtualenv for Python 2.6
119-
ansible.builtin.include_tasks:
120-
file: venv.yml
121-
vars:
122-
py_data: py26
123-
venv_data: venv26
124-
when: python_26
125-
126-
- name: Install Virtualenv for Python 2.7
127-
ansible.builtin.include_tasks:
128-
file: venv.yml
129-
vars:
130-
py_data: py27
131-
venv_data: venv27
132-
when: python_27
12+
- name: Install virtualenvs
13+
ansible.builtin.import_tasks: venvs.yml
13314

13415
- name: Miscellaneous
13516
ansible.builtin.import_tasks: misc.yml

tasks/python2x.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
3+
- name: Install Python 2.4
4+
ansible.builtin.import_tasks: python24.yml
5+
6+
- name: Install Python 2.6
7+
ansible.builtin.import_tasks: python26.yml
8+
9+
- name: Install Python 2.7
10+
ansible.builtin.include_tasks:
11+
file: python_generic.yml
12+
vars:
13+
py_data: "{{ py27 }}"
14+
when: python_27

tasks/python3x.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
3+
- name: Install Python 3.1
4+
ansible.builtin.include_tasks:
5+
file: python_generic.yml
6+
vars:
7+
py_data: "{{ py31 }}"
8+
when: python_31
9+
10+
- name: Install Python 3.2
11+
ansible.builtin.include_tasks:
12+
file: python_generic.yml
13+
vars:
14+
py_data: "{{ py32 }}"
15+
when: python_32
16+
17+
- name: Install Python 3.3
18+
ansible.builtin.include_tasks:
19+
file: python_generic.yml
20+
vars:
21+
py_data: "{{ py33 }}"
22+
when: python_33
23+
24+
- name: Install Python 3.4
25+
ansible.builtin.include_tasks:
26+
file: python_generic.yml
27+
vars:
28+
py_data: "{{ py34 }}"
29+
when: python_34
30+
31+
- name: Install Python 3.5
32+
ansible.builtin.include_tasks:
33+
file: python_generic.yml
34+
vars:
35+
py_data: "{{ py35 }}"
36+
when: python_35
37+
38+
- name: Install Python 3.6
39+
ansible.builtin.include_tasks:
40+
file: python_generic.yml
41+
vars:
42+
py_data: "{{ py36 }}"
43+
when: python_36
44+
45+
- name: Install Python 3.7
46+
ansible.builtin.include_tasks:
47+
file: python_generic.yml
48+
vars:
49+
py_data: "{{ py37 }}"
50+
when: python_37
51+
52+
- name: Install Python 3.8
53+
ansible.builtin.include_tasks:
54+
file: python_generic.yml
55+
vars:
56+
py_data: "{{ py38 }}"
57+
when: python_38
58+
59+
- name: Install Python 3.9
60+
ansible.builtin.include_tasks:
61+
file: python_generic.yml
62+
vars:
63+
py_data: "{{ py39 }}"
64+
when: python_39
65+
66+
- name: Install Python 3.10
67+
ansible.builtin.include_tasks:
68+
file: python_generic.yml
69+
vars:
70+
py_data: "{{ py310 }}"
71+
when: python_310
72+
73+
- name: Install Python 3.11
74+
ansible.builtin.include_tasks:
75+
file: python_generic.yml
76+
vars:
77+
py_data: "{{ py311 }}"
78+
when: python_311
79+
80+
- name: Install Python 3.12
81+
ansible.builtin.include_tasks:
82+
file: python_generic.yml
83+
vars:
84+
py_data: py312
85+
when: python_312
86+
87+
- name: Install Python 3.13
88+
ansible.builtin.include_tasks:
89+
file: python_generic.yml
90+
vars:
91+
py_data: py313
92+
when: python_313

tasks/venvs.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
3+
- name: Install Virtualenv for Python 2.4
4+
ansible.builtin.include_tasks:
5+
file: venv.yml
6+
vars:
7+
py_data: py24
8+
venv_data: venv24
9+
when: python_24
10+
11+
- name: Install Virtualenv for Python 2.6
12+
ansible.builtin.include_tasks:
13+
file: venv.yml
14+
vars:
15+
py_data: py26
16+
venv_data: venv26
17+
when: python_26
18+
19+
- name: Install Virtualenv for Python 2.7
20+
ansible.builtin.include_tasks:
21+
file: venv.yml
22+
vars:
23+
py_data: py27
24+
venv_data: venv27
25+
when: python_27

0 commit comments

Comments
 (0)