--- - hosts: qemuhosts tasks: - name: Update all installed packages using YUM module yum: name: '*' state: latest update_cache: yes update_only: yes register: yum_update_status - name: Remove packates not needed anymore yum: autoremove: yes - name: Reboot when packages were updated reboot: when: yum_update_status.changed - hosts: ctxhosts tasks: - name: Update all installed packages using APT module apt: name: '*' state: latest update_cache: yes only_upgrade: yes register: apt_update_status - name: Remove packages not needed anymore apt: autoremove: yes - name: Reboot when packages were updated reboot: post_reboot_delay: 60 when: apt_update_status.changed - hosts: ipkg tasks: - name: Update the Packages installed on Diskstation command: /opt/bin/ipkg update && /opt/bin/ipkg upgrade - hosts: windowshosts tasks: - name: Install all updates and reboot as many times as needed ansible.windows.win_updates: category_names: '*' reboot: yes # Optionally, you can increase the reboot_timeout to survive long updates during reboot - name: Ensure we wait long enough for the updates to be applied during reboot ansible.windows.win_updates: reboot: yes reboot_timeout: 3600