- name: Upgrade
  become: "{{ false if inventory_hostname == 'nas.home.lan' else true }}"
  block:
    - name: Include vault
      ansible.builtin.include_vars:
        file: jaydee.yml
    - name: Include facts
      ansible.builtin.include_role:
        name: setup
      when: ansible_facts.architecture is not defined

    - name: Upgrade Debian
      ansible.builtin.apt:
        update_cache: true
        upgrade: full
      when: ansible_facts.os_family == "Debian"
    
    - name: Upgrade RHEL / Rocky / Alma / CentOS
      ansible.builtin.dnf:
        name: "*"
        state: latest
      when: ansible_facts.os_family == "RedHat"

    - name: Upgrade SUSE
      ansible.builtin.zypper:
        name: "*"
        state: latest
      when: ansible_facts.os_family == "Suse"

    - name: Upgrade flatpack
      ansible.builtin.command: flatpak update -y
      when: inventory_hostname == 'morefine.home.lan'
      register: logo
      changed_when: "logo.rc == 0"
