---
- hosts: all
  roles:
    - { role: authorized_keys, tags: init_ssh }

- hosts: desktop:laptop
  tags: limit
  tasks:
    - name: Limit to Archlinux and NixOS
      fail:
        msg: "{{ ansible_distribution }} is not supported with this tag."
      when: (ansible_distribution != "Archlinux") and
            (ansible_distribution != "NixOS")
    
    - name: Limit to user accounts
      fail:
        msg: "Don't run as root."
      when: ansible_user_id == "root"

# Configure user cli
- hosts: server:desktop:laptop
  roles:
    - { role: fish, tags: fish }
    - { role: neovim, tags: neovim }
    - { role: screen, tags: screen }
    - { role: git, tags: git }
    - { role: userbin, tags: userbin }

# Configure root cli
- hosts: server:desktop:laptop
  become: yes

  roles:
    - { role: fish, tags: fish }
    - { role: neovim, tags: neovim }
    - { role: screen, tags: screen }
    - { role: git, tags: git }
    - { role: userbin, tags: userbin }

- hosts: desktop:laptop
  roles:
    - role: ssh-agent
      tags: ssh-agent
      when: ansible_distribution == "Archlinux"
    - { role: gtk, tags: gtk }
    - { role: sway, tags: sway }
    - { role: waybar, tags: waybar }
    - { role: variety, tags: variety }
    - { role: wofi, tags: wofi }
    - { role: kitty, tags: kitty }
    - { role: openvpn, tags: openvpn }
    - { role: borgbackup, tags: borgbackup }
    - { role: tiny, tags: tiny }
  tasks:
    - include_role:
        name: vagrant
      when: ansible_user_id == "vagrant"
      tags: vagrant
