---
- name: Remove externally managed from Debian 12
  ansible.builtin.import_tasks: debian12.yml
  when:
    - ansible_distribution == "Debian"
    - ansible_distribution_major_version|int >= 12

- name: Ensure Pip is installed.
  package:
    name: "{{ pip_package }}"
    state: present

- name: Ensure pip_install_packages are installed.
  pip:
    name: "{{ item.name | default(item) }}"
    version: "{{ item.version | default(omit) }}"
    virtualenv: "{{ item.virtualenv | default(omit) }}"
    state: "{{ item.state | default(omit) }}"
    extra_args: "{{ item.extra_args | default(omit) }}"
    executable: "{{ item.virtualenv | default(false) | ternary(omit, pip_executable) }}"
  loop: "{{ pip_install_packages }}"
