- hosts: pfservers
  name: upgrade EL OS to latest version
  become: True
  gather_facts: False
  tags: upgrade

  collections:
    - debops.debops
    - debops.roles01
    - debops.roles02
    - debops.roles03

  pre_tasks:
  - name: Gather min only
    ansible.builtin.setup:
      gather_subset:
        - "!all"

  tasks:
    - import_tasks: tasks/disable_apt_services.yml
      tags: apt_services

    - name: update to latest OS version (Deb)
      apt:
        name: '*'
        state: latest
        update_cache: yes
      register: upgrade_os_deb_register
      when: ansible_os_family == 'Debian'

    - name: reboot to have latest Linux kernel packages in place when installing PacketFence
      reboot:
      when: upgrade_os_deb_register is changed
