---
- name: Create install directory
  become: true
  ansible.builtin.file:
    path: /opt/pipx
    state: directory
    owner: "{{ ansible_user }}"
    group: "{{ skylab_group_admin.name }}"
    mode: 0755

- name: Create install venv
  ansible.builtin.command:
    cmd: python3 -m venv /opt/pipx
    creates: /opt/pipx/bin/python

- name: Install pipx
  ansible.builtin.pip:
    name:
      - pipx
    executable: /opt/pipx/bin/pip

- name: Link pipx binary into system path
  become: true
  ansible.builtin.file:
    state: link
    src: /opt/pipx/bin/pipx
    path: /usr/local/bin/pipx
