Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

win_updates can't update reboot_required status on WinServer 2019 #59056

Closed
pawellrus opened this issue Jul 13, 2019 · 21 comments
Closed

win_updates can't update reboot_required status on WinServer 2019 #59056

pawellrus opened this issue Jul 13, 2019 · 21 comments
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team. windows Windows community

Comments

@pawellrus
Copy link

pawellrus commented Jul 13, 2019

SUMMARY

I faced with a strange issue when I was trying to install updates for Windows Server 2019.
Playbook stuck in rebooting loop.

ISSUE TYPE
  • Bug Report
COMPONENT NAME
win_updates
ANSIBLE VERSION
ansible 2.8.1
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/polushin/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Jun 20 2019, 20:27:34) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)
STEPS TO REPRODUCE
- name: Check for Updates
    win_updates:
      state: searched
      category_names: ['Application','CriticalUpdates','DefinitionUpdates','FeaturePacks','SecurityUpdates','ServicePacks','Tools','UpdateRollups','Updates']
      log_path: 'c:/ansible_wu.txt'
    register: searched
    
  - name: Return update list
    debug:
      msg: '{{ item }}'
    loop: "{{ searched.updates|json_query('*.title[]') }}"
    
  - name: Install updates
    win_updates:
      category_names: ['Application','CriticalUpdates','DefinitionUpdates','FeaturePacks','SecurityUpdates','ServicePacks','Tools','UpdateRollups','Updates']
      log_path: 'c:/ansible_wu.txt'
      reboot: yes
    when: searched.found_update_count>0
EXPECTED RESULTS

Windows Server gets updated.

ACTUAL RESULTS

reboot_required status isn't get lifted after ansible initiated reboot. Playbook stuck in reboot loop.
User needs to log on to server and reboot server from Windows Update GUI.

2019-07-13 08:18:03Z WUA is available in current logon process, running natively
2019-07-13 08:18:03Z Creating Windows Update session...
2019-07-13 08:18:03Z Create Windows Update searcher...
2019-07-13 08:18:03Z Setting the Windows Update Agent source catalog...
2019-07-13 08:18:03Z Requested search source is 'default'
2019-07-13 08:18:03Z Search source set to 'default' (ServerSelection = 0)
2019-07-13 08:18:03Z Searching for updates to install
2019-07-13 08:18:10Z Found 1 updates
2019-07-13 08:18:10Z Creating update collection...
2019-07-13 08:18:10Z Adding update 299b218e-aa1b-400f-8364-7088a4061dbf - 2019-07 Cumulative Update for Windows Server 2019 (1809) for x64-based Systems (KB4507469)
2019-07-13 08:18:10Z Calculating pre-install reboot requirement...
2019-07-13 08:18:10Z No reboot is pending...
2019-07-13 08:18:10Z Downloading updates...
2019-07-13 08:18:10Z Update (1 of 1) 299b218e-aa1b-400f-8364-7088a4061dbf already downloaded, skipping...
2019-07-13 08:18:10Z Installing updates...
2019-07-13 08:18:10Z Creating installer object...
2019-07-13 08:18:10Z Creating install collection...
2019-07-13 08:18:10Z Adding update 299b218e-aa1b-400f-8364-7088a4061dbf
2019-07-13 08:18:12Z Update (1 of 1) 299b218e-aa1b-400f-8364-7088a4061dbf succeeded
2019-07-13 08:18:12Z Performing post-install reboot requirement check...
2019-07-13 08:18:12Z Return value:
{
    "updates":  {
                    "299b218e-aa1b-400f-8364-7088a4061dbf":  {
                                                                 "id":  "299b218e-aa1b-400f-8364-7088a4061dbf",
                                                                 "title":  "2019-07 Cumulative Update for Windows Server 2019 (1809) for x64-based Systems (KB4507469)",
                                                                 "categories":  [
                                                                                    "Security Updates"
                                                                                ],
                                                                 "kb":  [
                                                                            "4507469"
                                                                        ],
                                                                 "installed":  true
                                                             }
                },
    "failed_update_count":  0,
    "found_update_count":  1,
    "changed":  false,
    "reboot_required":  true,
    "installed_update_count":  1,
    "filtered_updates":  {

                         }
}
2019-07-13 08:18:12Z Native job completed with output: 
Name                           Value                                                                                                                                                                                                                                                                        
----                           -----                                                                                                                                                                                                                                                                        
updates                        {299b218e-aa1b-400f-8364-7088a4061dbf}                                                                                                                                                                                                                                       
failed_update_count            0                                                                                                                                                                                                                                                                            
found_update_count             1                                                                                                                                                                                                                                                                            
changed                        False                                                                                                                                                                                                                                                                        
reboot_required                True                                                                                                                                                                                                                                                                         
installed_update_count         1                                                                                                                                                                                                                                                                            
filtered_updates               {}                                                                                                                                                                                                                                                                           



2019-07-13 08:18:34Z WUA is available in current logon process, running natively
2019-07-13 08:18:34Z Creating Windows Update session...
2019-07-13 08:18:34Z Create Windows Update searcher...
2019-07-13 08:18:34Z Setting the Windows Update Agent source catalog...
2019-07-13 08:18:34Z Requested search source is 'default'
2019-07-13 08:18:34Z Search source set to 'default' (ServerSelection = 0)
2019-07-13 08:18:35Z Searching for updates to install
2019-07-13 08:18:41Z Found 1 updates
2019-07-13 08:18:41Z Creating update collection...
2019-07-13 08:18:41Z Adding update 299b218e-aa1b-400f-8364-7088a4061dbf - 2019-07 Cumulative Update for Windows Server 2019 (1809) for x64-based Systems (KB4507469)
2019-07-13 08:18:41Z Calculating pre-install reboot requirement...
2019-07-13 08:18:41Z No reboot is pending...
2019-07-13 08:18:41Z Downloading updates...
2019-07-13 08:18:41Z Update (1 of 1) 299b218e-aa1b-400f-8364-7088a4061dbf already downloaded, skipping...
2019-07-13 08:18:41Z Installing updates...
2019-07-13 08:18:41Z Creating installer object...
2019-07-13 08:18:41Z Creating install collection...
2019-07-13 08:18:41Z Adding update 299b218e-aa1b-400f-8364-7088a4061dbf
2019-07-13 08:18:43Z Update (1 of 1) 299b218e-aa1b-400f-8364-7088a4061dbf succeeded
2019-07-13 08:18:43Z Performing post-install reboot requirement check...
2019-07-13 08:18:43Z Return value:
{
    "updates":  {
                    "299b218e-aa1b-400f-8364-7088a4061dbf":  {
                                                                 "id":  "299b218e-aa1b-400f-8364-7088a4061dbf",
                                                                 "title":  "2019-07 Cumulative Update for Windows Server 2019 (1809) for x64-based Systems (KB4507469)",
                                                                 "categories":  [
                                                                                    "Security Updates"
                                                                                ],
                                                                 "kb":  [
                                                                            "4507469"
                                                                        ],
                                                                 "installed":  true
                                                             }
                },
    "failed_update_count":  0,
    "found_update_count":  1,
    "changed":  false,
    "reboot_required":  true,
    "installed_update_count":  1,
    "filtered_updates":  {

                         }
}
2019-07-13 08:18:43Z Native job completed with output: 
Name                           Value                                                                                                                                                                                                                                                                        
----                           -----                                                                                                                                                                                                                                                                        
updates                        {299b218e-aa1b-400f-8364-7088a4061dbf}                                                                                                                                                                                                                                       
failed_update_count            0                                                                                                                                                                                                                                                                            
found_update_count             1                                                                                                                                                                                                                                                                            
changed                        False                                                                                                                                                                                                                                                                        
reboot_required                True                                                                                                                                                                                                                                                                         
installed_update_count         1                                                                                                                                                                                                                                                                            
filtered_updates               {}  
@ansibot
Copy link
Contributor

ansibot commented Jul 13, 2019

Files identified in the description:
None

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Jul 13, 2019
@pawellrus pawellrus changed the title win_update can't update reboot_required status on WinServer 2019 win_updates can't update reboot_required status on WinServer 2019 Jul 13, 2019
@ansibot
Copy link
Contributor

ansibot commented Jul 13, 2019

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Jul 13, 2019

@ansibot ansibot added module This issue/PR relates to a module. windows Windows community labels Jul 13, 2019
@ShachafGoldstein
Copy link
Contributor

This could be a problem with the specific update - it has a lot of ui components, it might require an interactive logon to complete correctly
I'll try to test it but updates are a tricky one

@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label Jul 13, 2019
@ShachafGoldstein
Copy link
Contributor

@pawellrus - has this happened with any other update since?

@pawellrus
Copy link
Author

@ShachafGoldstein, i will check it soon. May be on next week.

@swickera
Copy link
Contributor

I've seen this too, and most recently today trying to install the round of September 2019 updates. It seems related to the 2019-09 cumulative rollup.. this keeps repeating over and over:

'WINRM STDOUT {"updates":{"644bb2c6-0f42-4216-8c9a-96541b6fbaa3":{"id":"644bb2c6-0f42-4216-8c9a-96541b6fbaa3","title":"2019-09 Cumulative Update for Windows Server 2019 (1809) for x64-based Systems (KB4512578)","categories":["Security Updates"],"kb":["4512578"],"installed":true}},"failed_update_count":0,"found_update_count":1,"changed":false,"reboot_required":true,"installed_update_count":1,"filtered_updates":{}}^[[0m'

@pawellrus
Copy link
Author

Hello again. September updates was installed without this issue in my environment.

@swickera
Copy link
Contributor

update: I seem to be able to work around the issue by forcing a reboot before calling the win_updates module...

@pawellrus
Copy link
Author

pawellrus commented Oct 31, 2019

Got the same infinite reboot cycle today again.
Servers were clean-deployed before.
I had to log on manually to each server and reload update process from gui.
All servers had 0x80240007 update error in gui.

@ShachafGoldstein
Copy link
Contributor

Can you say which updates were installed? since that error is a very generic error of WU it has hard to pinpoint the issue.

@pawellrus
Copy link
Author

That was October cumulative update KB4519338.

I has another issue recently with searching of new updates. New updates weren't been found when running process from ansible. But starting update process from GUI gave a couple of new updates. But that issue gone after some time.

I didn't experienced such problems at older versions of WinServer. There is definetely some issue in server 2019 that makes win_update module unreliable.

@ShachafGoldstein
Copy link
Contributor

ShachafGoldstein commented Nov 18, 2019 via email

@jpgrall
Copy link

jpgrall commented Nov 25, 2019

Same issue is happening for the November cumulative update (KB4523205).

@jpgrall
Copy link

jpgrall commented Nov 26, 2019

Adding a win_reboot just before the start of win_update seems to have provided a valid work around. BTW, In my scenario this playbook is being ran on a new system build.

@ShachafGoldstein
Copy link
Contributor

Do you see the server rebooting in your scenarios?, could the issue be around not actually rebooting the server?

@jpgrall
Copy link

jpgrall commented Nov 26, 2019

Yes, it's kicking off a reboot shortly after the attempted install. It's as if it gets a completed return call rather than a wait. Adding the manual reboot before the win_update process is working on multiple runs now.

@ShachafGoldstein
Copy link
Contributor

So if you simply reboot and then install updates everything works? Or you reboot between updates?

Can you post a verbose output of a failed one and a working one?

@mhazri
Copy link

mhazri commented Feb 13, 2020

Hi
I have similar issue, windows update successfully and along the process the window is rebooted few time successfully. But on the ansible result, "reboot_required=false".
reboot_required_false_issue

@ShachafGoldstein
Copy link
Contributor

@mhazri Seems you are talking about something else, this issue is about reboot loop caused by Ansible.
Maybe open a different issue on your problem?

@jborean93
Copy link
Contributor

Issue has been migrated to ansible-collections/ansible.windows#25

@ansible ansible locked and limited conversation to collaborators Apr 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team. windows Windows community
Projects
None yet
Development

No branches or pull requests

7 participants