|
14 | 14 | - "pypy3.6-7.3.1" |
15 | 15 | pyenv_virtualenvs: [] |
16 | 16 |
|
17 | | -- name: Ensure pre-commit and pipx are installed |
| 17 | +- name: Ensure python3-venv is installed |
18 | 18 | pip: |
19 | 19 | state: present |
20 | | - name: |
21 | | - - pre-commit |
22 | | - - pipx |
| 20 | + name: python3-venv |
23 | 21 |
|
24 | | -- name: Check if cookiecutter is installed |
25 | | - command: cookiecutter --version |
26 | | - register: cookiecutter_version_cmd |
| 22 | +- name: Check if pipx is installed |
| 23 | + command: pipx --version |
| 24 | + register: pipx_version_cmd |
27 | 25 | changed_when: false |
28 | 26 | ignore_errors: true |
29 | 27 |
|
| 28 | +- name: Install pipx |
| 29 | + package: |
| 30 | + state: present |
| 31 | + name: pipx |
| 32 | + become: true |
| 33 | + when: pipx_version_cmd is failed |
| 34 | + |
| 35 | +- name: Check if pre-commit is installed |
| 36 | + stat: |
| 37 | + path: "{{ ansible_env.HOME }}/.local/pipx/venvs/pre-commit" |
| 38 | + register: pre_commit_folder_check |
| 39 | + |
| 40 | +- name: Install pre-commit |
| 41 | + command: pipx install pre-commit |
| 42 | + register: output |
| 43 | + when: pre_commit_folder_check is failed |
| 44 | + |
| 45 | +- name: Check if cookiecutter is installed |
| 46 | + stat: |
| 47 | + path: "{{ ansible_env.HOME }}/.local/pipx/venvs/cookiecutter" |
| 48 | + register: cookiecutter_folder_check |
| 49 | + |
30 | 50 | - name: Install cookiecutter |
31 | 51 | command: pipx install cookiecutter |
32 | 52 | register: output |
33 | | - when: cookiecutter_version_cmd is failed |
| 53 | + when: cookiecutter_folder_check is failed |
34 | 54 |
|
35 | 55 | - name: Check if poetry is installed |
36 | | - command: poetry --version |
37 | | - register: poetry_version_cmd |
| 56 | + command: poetry |
| 57 | + register: poetry_cmd |
38 | 58 | changed_when: false |
39 | 59 | ignore_errors: true |
40 | 60 |
|
|
43 | 63 | url: https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py |
44 | 64 | dest: "{{ ansible_env.HOME }}/get-poetry.py" |
45 | 65 | mode: "0400" |
46 | | - when: poetry_version_cmd is failed |
| 66 | + when: poetry_cmd is failed |
47 | 67 | notify: delete poetry installer |
48 | 68 |
|
49 | 69 | - name: Install poetry |
50 | 70 | command: "python3 {{ ansible_env.HOME }}/get-poetry.py" |
51 | | - when: poetry_version_cmd is failed |
| 71 | + when: poetry_cmd is failed |
52 | 72 |
|
53 | 73 | - name: Check if nox is installed |
54 | | - command: nox --version |
55 | | - register: nox_version_cmd |
56 | | - changed_when: false |
57 | | - ignore_errors: true |
| 74 | + stat: |
| 75 | + path: "{{ ansible_env.HOME }}/.local/pipx/venvs/nox" |
| 76 | + register: nox_folder_check |
58 | 77 |
|
59 | 78 | - name: Install nox |
60 | 79 | command: pipx install nox |
61 | | - when: nox_version_cmd is failed |
| 80 | + when: nox_folder_check is failed |
62 | 81 |
|
63 | 82 | - name: Install nox-poetry |
64 | 83 | command: pipx inject nox nox-poetry |
|
0 commit comments