  # first install pip with easy_install if pip is not present on the system
  # we cannot use the python-pip package as it is too old in many OS
  - name: Register pip installation status
    command: which pip
    changed_when: false
    ignore_errors: True
    register: pip_installed

  - name: Register pip3 installation status
    command: which pip3
    changed_when: false
    ignore_errors: True
    register: pip3_installed

  - name: Install slapcache on Debian < 9
    include: pip_installations_success.yml
    when: ansible_distribution == "Debian" and ansible_distribution_major_version|int < 9

  - name: Install slapcache on Debian >= 9
    include: pip_installations_succeeded.yml
    when: ansible_distribution == "Debian" and ansible_distribution_major_version|int >= 9
