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

# @action Ensures Microsoft Edge is installed
# Installs Microsoft Edge on Archlinux, CentOS, Debian, Fedora, macOS, Ubuntu, 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 Microsoft Edge is installed
# Configures Microsoft Edge as the default Browser if desired
- name: "Set {{ app_name }} as the default browser"
  vars:
    default_browser_chosen: "{{ default_browser }}"
  include_role:
    name: helpers/defaultbrowser
  when:
    - default_browser == 'edge'
    - ansible_os_family != 'Windows'
