42 lines
1.6 KiB
YAML
42 lines
1.6 KiB
YAML
- name: Install and configure Python + tools
|
|
tags: python
|
|
become: true
|
|
become_user: "{{ default_user }}"
|
|
block:
|
|
- name: Install Pyenv
|
|
shell: curl https://pyenv.run | zsh
|
|
args:
|
|
creates: "{{ default_user_home }}/.pyenv/bin/pyenv"
|
|
environment:
|
|
PYENV_ROOT: "{{ default_user_home }}/.pyenv"
|
|
|
|
- name: Install Pyenv version of Python
|
|
shell: "{{ default_user_home }}/.pyenv/bin/pyenv install {{ pyenv_python_version }}"
|
|
args:
|
|
creates: "{{ default_user_home }}/.pyenv/versions/{{ pyenv_python_version }}/bin/python"
|
|
when: install_pyenv_python
|
|
|
|
- name: Install pipx
|
|
command: python3 -m pip install pipx --user
|
|
args:
|
|
creates: "{{ default_user_home }}/.local/bin/pipx"
|
|
|
|
- name: Install pipx packages
|
|
shell: "{{ default_user_home }}/.local/bin/pipx install {{ item }} --force --include-deps"
|
|
loop: "{{ pipx_packages }}"
|
|
|
|
- name: Install Poetry
|
|
shell: curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3
|
|
args:
|
|
creates: "{{ default_user_home }}/.poetry/bin/poetry"
|
|
|
|
- name: Install Poetry plugin for oh-my-zsh
|
|
shell: |
|
|
mkdir {{ default_user_home }}/.oh-my-zsh/custom/plugins/poetry
|
|
{{ default_user_home }}/.poetry/bin/poetry completions zsh > {{ default_user_home }}/.oh-my-zsh/custom/plugins/poetry/_poetry
|
|
args:
|
|
creates: "{{ default_user_home }}/.oh-my-zsh/custom/plugins/poetry"
|
|
|
|
- name: Configure Poetry
|
|
command: "{{ default_user_home }}/.poetry/bin/poetry config virtualenvs.in-project true"
|