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