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

# @action Ensures Tor is installed
# Installs Tor on Archlinux, CentOS, Debian, Fedora, Ubuntu, MacOS and Windows
# @action Ensures Tor is installed
# Installs Privoxy on Archlinux, CentOS, Debian, Fedora, Ubuntu, MacOS and Windows
# @action Ensures Tor is configured
# Creates Tor service on Windows
# @action Ensures Tor is configured
# Forwards proxy connections to Tor
# @action Ensures Tor is configured
# Enforces using USA exit node with Tor connections
# @action Ensures Tor is configured
# Configures GNOME Proxy setting to use Tor if GNOME is installed
- name: Include tasks based on the operating system
  become: true
  block:
    - include_tasks: "install-{{ ansible_os_family }}.yml"

- name: Check if GNOME is installed
  stat:
    path: "{{ gnome_shell_path }}"
  register: gnome_shell
  when: ansible_system == 'Linux'

- name: Add GNOME settings
  include_tasks: settings-GNOME.yml
  loop: "{{ user_configs }}"
  loop_control:
    label: "{{ user.username }}"
    loop_var: user
  when:
    - ansible_system == 'Linux'
    - gnome_shell.stat.exists
