|
1 | 1 | --- |
| 2 | +- name: Load custom facts |
| 3 | + ansible.builtin.import_tasks: custom_facts.yml |
| 4 | + |
2 | 5 | - name: Install pyenv |
3 | 6 | ansible.builtin.import_role: |
4 | 7 | name: staticdev.pyenv |
|
17 | 20 | - python3-venv # needed for nox |
18 | 21 |
|
19 | 22 | - name: Check if pipx is installed |
20 | | - ansible.builtin.command: "{{ ansible_env.HOME }}/.local/bin/pipx --version" |
| 23 | + ansible.builtin.command: "{{ pipx_path }}/pipx --version" |
21 | 24 | register: pipx_version_cmd |
22 | 25 | changed_when: false |
23 | 26 | ignore_errors: true |
24 | 27 |
|
25 | | -- name: Install pipx |
| 28 | +- name: Install pipx on Debian Bookworm |
| 29 | + ansible.builtin.package: |
| 30 | + name: pipx |
| 31 | + when: pipx_version_cmd is failed and ansible_distribution_release == 'bookworm' |
| 32 | + |
| 33 | +- name: Install pipx on non-Bookworm OS |
26 | 34 | ansible.builtin.pip: |
27 | 35 | name: pipx |
28 | 36 | extra_args: --user |
29 | | - when: pipx_version_cmd is failed |
| 37 | + when: pipx_version_cmd is failed and ansible_distribution_release != 'bookworm' |
30 | 38 |
|
31 | 39 | - name: Check if pre-commit is installed |
32 | 40 | ansible.builtin.command: "{{ ansible_env.HOME }}/.local/bin/pre-commit --version" |
|
35 | 43 | ignore_errors: true |
36 | 44 |
|
37 | 45 | - name: Install pre-commit |
38 | | - ansible.builtin.command: "{{ ansible_env.HOME }}/.local/bin/pipx install pre-commit" |
| 46 | + ansible.builtin.command: "{{ pipx_path }}/pipx install pre-commit" |
39 | 47 | register: output |
40 | 48 | changed_when: "output.rc == 0" |
41 | 49 | when: pre_commit_check is failed |
|
44 | 52 | ansible.builtin.stat: |
45 | 53 | path: "{{ ansible_env.HOME }}/.local/pipx/venvs/cookiecutter" |
46 | 54 | register: cookiecutter_folder_check |
| 55 | + ignore_errors: true |
47 | 56 |
|
48 | 57 | - name: Install cookiecutter |
49 | | - ansible.builtin.command: "{{ ansible_env.HOME }}/.local/bin/pipx install cookiecutter" |
| 58 | + ansible.builtin.command: "{{ pipx_path }}/pipx install cookiecutter" |
50 | 59 | register: output |
51 | 60 | changed_when: "output.rc == 0" |
52 | 61 | when: cookiecutter_folder_check is failed |
|
79 | 88 | ignore_errors: true |
80 | 89 |
|
81 | 90 | - name: Install nox |
82 | | - ansible.builtin.command: "{{ ansible_env.HOME }}/.local/bin/pipx install nox" |
| 91 | + ansible.builtin.command: "{{ pipx_path }}/pipx install nox" |
83 | 92 | register: output |
84 | 93 | changed_when: "output.rc == 0" |
85 | 94 | when: nox_version_cmd is failed |
86 | 95 |
|
87 | 96 | - name: Install nox-poetry |
88 | | - ansible.builtin.command: "{{ ansible_env.HOME }}/.local/bin/pipx inject nox nox-poetry" |
| 97 | + ansible.builtin.command: "{{ pipx_path }}/pipx inject nox nox-poetry" |
89 | 98 | register: output |
90 | 99 | changed_when: "output.rc == 0" |
91 | 100 | when: nox_version_cmd is failed |
|
97 | 106 | ignore_errors: true |
98 | 107 |
|
99 | 108 | - name: Install tox |
100 | | - ansible.builtin.command: "{{ ansible_env.HOME }}/.local/bin/pipx install tox" |
| 109 | + ansible.builtin.command: "{{ pipx_path }}/pipx install tox" |
101 | 110 | register: output |
102 | 111 | changed_when: "output.rc == 0" |
103 | 112 | when: tox_version_cmd is failed |
0 commit comments