Skip to content

Commit

Permalink
chore: reorganize code
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gforcada committed May 11, 2024
1 parent a1259ca commit efa3579
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 125 deletions.
131 changes: 6 additions & 125 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,133 +3,14 @@
- name: Install dependencies
ansible.builtin.import_tasks: deps.yml

- name: Install Python 2.4
ansible.builtin.import_tasks: python24.yml
- name: Install Python 2.x
ansible.builtin.import_tasks: python2x.yml

- name: Install Python 2.6
ansible.builtin.import_tasks: python26.yml
- name: Install Python 3.x
ansible.builtin.import_tasks: python3x.yml

- name: Install Python 2.7
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py27 }}"
when: python_27

- name: Install Python 3.1
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py31 }}"
when: python_31

- name: Install Python 3.2
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py32 }}"
when: python_32

- name: Install Python 3.3
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py33 }}"
when: python_33

- name: Install Python 3.4
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py34 }}"
when: python_34

- name: Install Python 3.5
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py35 }}"
when: python_35

- name: Install Python 3.6
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py36 }}"
when: python_36

- name: Install Python 3.7
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py37 }}"
when: python_37

- name: Install Python 3.8
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py38 }}"
when: python_38

- name: Install Python 3.9
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py39 }}"
when: python_39

- name: Install Python 3.10
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py310 }}"
when: python_310

- name: Install Python 3.11
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py311 }}"
when: python_311

- name: Install Python 3.12
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: py312
when: python_312

- name: Install Python 3.13
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: py313
when: python_313

- name: Install Virtualenv for Python 2.4
ansible.builtin.include_tasks:
file: venv.yml
vars:
py_data: py24
venv_data: venv24
when: python_24

- name: Install Virtualenv for Python 2.6
ansible.builtin.include_tasks:
file: venv.yml
vars:
py_data: py26
venv_data: venv26
when: python_26

- name: Install Virtualenv for Python 2.7
ansible.builtin.include_tasks:
file: venv.yml
vars:
py_data: py27
venv_data: venv27
when: python_27
- name: Install virtualenvs
ansible.builtin.import_tasks: venvs.yml

- name: Miscellaneous
ansible.builtin.import_tasks: misc.yml
14 changes: 14 additions & 0 deletions tasks/python2x.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---

- name: Install Python 2.4
ansible.builtin.import_tasks: python24.yml

- name: Install Python 2.6
ansible.builtin.import_tasks: python26.yml

- name: Install Python 2.7
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py27 }}"
when: python_27
92 changes: 92 additions & 0 deletions tasks/python3x.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---

- name: Install Python 3.1
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py31 }}"
when: python_31

- name: Install Python 3.2
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py32 }}"
when: python_32

- name: Install Python 3.3
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py33 }}"
when: python_33

- name: Install Python 3.4
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py34 }}"
when: python_34

- name: Install Python 3.5
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py35 }}"
when: python_35

- name: Install Python 3.6
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py36 }}"
when: python_36

- name: Install Python 3.7
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py37 }}"
when: python_37

- name: Install Python 3.8
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py38 }}"
when: python_38

- name: Install Python 3.9
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py39 }}"
when: python_39

- name: Install Python 3.10
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py310 }}"
when: python_310

- name: Install Python 3.11
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py311 }}"
when: python_311

- name: Install Python 3.12
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: py312
when: python_312

- name: Install Python 3.13
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: py313
when: python_313
25 changes: 25 additions & 0 deletions tasks/venvs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---

- name: Install Virtualenv for Python 2.4
ansible.builtin.include_tasks:
file: venv.yml
vars:
py_data: py24
venv_data: venv24
when: python_24

- name: Install Virtualenv for Python 2.6
ansible.builtin.include_tasks:
file: venv.yml
vars:
py_data: py26
venv_data: venv26
when: python_26

- name: Install Virtualenv for Python 2.7
ansible.builtin.include_tasks:
file: venv.yml
vars:
py_data: py27
venv_data: venv27
when: python_27

0 comments on commit efa3579

Please sign in to comment.