---
- name: Ensure dependencies are installed.
  apt:
    name: dirmngr
    state: present

- name: Ensure PPA for GlusterFS is present.
  apt_repository:
    repo: 'ppa:gluster/glusterfs-{{ glusterfs_ppa_version }}'
    state: present
    update_cache: true
  register: glusterfs_ppa_added
  when: glusterfs_ppa_use

- name: Ensure GlusterFS will reinstall if the PPA was just added.
  apt:
    name:
      - glusterfs-server
      - glusterfs-client
    state: absent
  when: glusterfs_ppa_added.changed
  tags: ['skip_ansible_lint']

- name: Ensure GlusterFS is installed.
  apt:
    name:
      - glusterfs-server
      - glusterfs-client
    state: present
    default_release: "{{ glusterfs_default_release }}"
