---
- name: Include variables based on the operating system
  include_vars: "{{ ansible_os_family }}.yml"

# @action Ensures restic is installed
# Installs restic on Archlinux, CentOS, Debian, Fedora, Ubuntu, MacOS and Windows
- name: Include tasks based on the operating system
  become: true
  become_method: "{{ 'runas' if ansible_os_family == 'Windows' else 'sudo' }}"
  become_user: "{{ ansible_user if ansible_os_family == 'Windows' else omit }}"
  block:
    - include_tasks: "install-{{ ansible_os_family }}.yml"

# @action Ensures restic is installed
# Installs git-cache-meta and docker-compose-backup scripts
- name: Install scripts required by Restic
  become: true
  block:
    - include_tasks: scripts-Linux.yml
  when: ansible_os_family != 'Windows'
