- name: Include quobyte-base Role
  include_role:
    name: quobyte-base

- name: Required Quobyte Client Software
  become: true
  apt:
    name:
      - quobyte-client
    state: latest
    cache_valid_time: 3600
  notify: Remount Quobyte
  when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
  tags: software

- name: Exclude Quobyte from updatedb
  become: true
  lineinfile:
    path: /etc/updatedb.conf
    state: present
    regexp: '^PRUNEFS="((?:(?!fuse\.quobyte).)*)"$'
    backrefs: true
    line: 'PRUNEFS="\1 fuse.quobyte"'

- name: Quobyte Client Config
  become: true
  template:
    dest: /etc/quobyte/client.cfg
    src: etc/quobyte/client.cfg.j2
    mode: "0600"

- name: Quobyte Client Using /etc/fstab
  include_tasks: fstab.yml
  when: ansible_distribution_major_version | int < 16

- name: Quobyte Client Using Systemd
  include_tasks: systemd.yml
  when: ansible_distribution_major_version | int >= 16
