---
- name: Updates all managed servers including localhost
  hosts: all
  become: true
  tasks:
    - name: Upgrade all packages to latest version
      ansible.builtin.dnf:
        name: "*"
        state: latest
      when: ansible_os_family == "RedHat"


    - name: Upgrade all packages to latest version
      ansible.builtin.apt:
        name: "*"
        state: latest
      when: ansible_os_family == "Debian"


  handlers:
    - name: reboot
      ansible.builtin.reboot:
        test_command: whoami

# work in progress for windows host
# - name: Upgrade software on windows hosts
#hosts: bane
#become: true
#tasks:
#- name: run updates on all windows hosts
#ansible.windows.win_whoami:
