Dot_Files/roles/zsh/tasks/install-poetry.yml

46 lines
1.2 KiB
YAML
Raw Normal View History

2022-08-01 16:07:57 -05:00
---
2022-08-02 01:34:41 -05:00
- name: Check if distutils is installed for Debian based systems
2022-08-02 15:02:45 -05:00
become: true
2022-08-02 01:34:41 -05:00
ansible.builtin.apt:
name:
- python3-apt
- python3-distutils
state: present
when: ansible_facts.os_family == 'Debian'
2022-08-01 16:07:57 -05:00
- name: Check if poetry is installed
ansible.builtin.stat:
path: "{{ xdg_data_home }}/poetry"
2022-08-01 16:07:57 -05:00
register: poetry_installed
changed_when: false
- name: Create poetry working directory
ansible.builtin.tempfile:
state: directory
register: poetry_work_dir
when: not poetry_installed.stat.exists
- name: Set poetry installer destination
ansible.builtin.set_fact:
2022-08-01 16:15:10 -05:00
poetry_install_dest: "{{ poetry_work_dir.path }}/poetry-install.py"
2022-08-01 16:07:57 -05:00
when: not poetry_installed.stat.exists
- name: Download poetry installer
ansible.builtin.get_url:
url: https://install.python-poetry.org/
dest: "{{ poetry_install_dest }}"
mode: 0644
when: not poetry_installed.stat.exists
- name: Install Poetry
ansible.builtin.shell: >
python3
"{{ poetry_install_dest }}"
-f
-y
environment:
POETRY_HOME: "{{ xdg_data_home }}/poetry"
2022-08-01 16:07:57 -05:00
register: poetry_installer
when: not poetry_installed.stat.exists
2022-08-01 16:07:57 -05:00
changed_when: not 'already installed' in poetry_installer.stdout