--- - name: Patch Windows Servers hosts: windows_servers gather_facts: true tasks: - name: Search for Windows updates ansible.windows.win_updates: category_names: "{{ windows_update_categories }}" state: searched register: update_search - name: Display available updates ansible.builtin.debug: msg: "{{ update_search.found_update_count }} updates available" - name: Install Windows updates ansible.windows.win_updates: category_names: "{{ windows_update_categories }}" state: installed reboot: true reboot_timeout: 3600 when: update_search.found_update_count > 0 register: update_result - name: Update CMDB with patch status ansible.builtin.debug: msg: "Would update ServiceNow CMDB with patch status" # TODO: Implement ServiceNow CMDB update