ansible-collections/ansible.windows

win_update show different trigger in Event Viewer

mxs-weixiong opened this issue · 2 comments

SUMMARY

win_update showing different trigger in Event Viewer

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_updates

ANSIBLE VERSION

Using awx-ee

quay.io/ansible/awx-ee:23.8.1

COLLECTION VERSION
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Downloading https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/chocolatey-chocolatey-1.5.1.tar.gz to /var/lib/awx/projects/.__awx_cache/_8__mxs_ansible_playbook/stage/tmp/ansible-local-15967o2rxlc48/tmpsbziz7r8/chocolatey-chocolatey-1.5.1-92ct7ccf
Installing 'chocolatey.chocolatey:1.5.1' to '/var/lib/awx/projects/.__awx_cache/_8__mxs_ansible_playbook/stage/requirements_collections/ansible_collections/chocolatey/chocolatey'
chocolatey.chocolatey:1.5.1 was installed successfully
Downloading https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/community-windows-2.2.0.tar.gz to /var/lib/awx/projects/.__awx_cache/_8__mxs_ansible_playbook/stage/tmp/ansible-local-15967o2rxlc48/tmpsbziz7r8/community-windows-2.2.0-onb97b4o
Installing 'community.windows:2.2.0' to '/var/lib/awx/projects/.__awx_cache/_8__mxs_ansible_playbook/stage/requirements_collections/ansible_collections/community/windows'
community.windows:2.2.0 was installed successfully
Downloading https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/ansible-windows-2.3.0.tar.gz to /var/lib/awx/projects/.__awx_cache/_8__mxs_ansible_playbook/stage/tmp/ansible-local-15967o2rxlc48/tmpsbziz7r8/ansible-windows-2.3.0-i4lzuooj
Installing 'ansible.windows:2.3.0' to '/var/lib/awx/projects/.__awx_cache/_8__mxs_ansible_playbook/stage/requirements_collections/ansible_collections/ansible/windows'
ansible.windows:2.3.0 was installed successfully
Downloading https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/community-aws-7.1.0.tar.gz to /var/lib/awx/projects/.__awx_cache/_8__mxs_ansible_playbook/stage/tmp/ansible-local-15967o2rxlc48/tmpsbziz7r8/community-aws-7.1.0-o2jewnuu
Installing 'community.aws:7.1.0' to '/var/lib/awx/projects/.__awx_cache/_8__mxs_ansible_playbook/stage/requirements_collections/ansible_collections/community/aws'
community.aws:7.1.0 was installed successfully
Downloading https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/amazon-aws-7.4.0.tar.gz to /var/lib/awx/projects/.__awx_cache/_8__mxs_ansible_playbook/stage/tmp/ansible-local-15967o2rxlc48/tmpsbziz7r8/amazon-aws-7.4.0-nqxxyvke
Installing 'amazon.aws:7.4.0' to '/var/lib/awx/projects/.__awx_cache/_8__mxs_ansible_playbook/stage/requirements_collections/ansible_collections/amazon/aws'
amazon.aws:7.4.0 was installed successfully
Downloading https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/community-general-8.4.0.tar.gz to /var/lib/awx/projects/.__awx_cache/_8__mxs_ansible_playbook/stage/tmp/ansible-local-15967o2rxlc48/tmpsbziz7r8/community-general-8.4.0-zrwrf65k
Installing 'community.general:8.4.0' to '/var/lib/awx/projects/.__awx_cache/_8__mxs_ansible_playbook/stage/requirements_collections/ansible_collections/community/general'
community.general:8.4.0 was installed successfully
OS / ENVIRONMENT

Window Server 2016

STEPS TO REPRODUCE
--- name: Install all updates and reboot as many times as needed
  tags: update
  ansible.windows.win_updates:
    category_names: "*"
    reboot: true
    reboot_timeout: 3600
    reject_list:
      - "Microsoft driver update for MS Publisher Imagesetter"
EXPECTED RESULTS
ansible.windows.win_updates - Invoked with:
  skip_optional: False
  log_path: $null
  category_names: 
    - *
  _operation_options: 
  reject_list: 
    - Microsoft driver update for MS Publisher Imagesetter
  reboot: True
  reboot_timeout: 3600
  accept_list: $null
  state: installed
  _operation: start
  server_selection: default
ACTUAL RESULTS
ansible.windows.win_updates - Invoked with:
  skip_optional: False
  log_path: $null
  category_names: 
    - *
  _operation_options: 
  reject_list: 
    - Microsoft driver update for MS Publisher Imagesetter
  reboot: True
  reboot_timeout: 3600
  accept_list: $null
  state: installed
  _operation: start
  server_selection: default

and

2nd trigger

ansible.windows.win_updates - Invoked with:
  skip_optional: False
  log_path: $null
  category_names: 
    - CriticalUpdates
    - SecurityUpdates
    - UpdateRollups
  _operation_options: pipe_name: Ansible.Windows.WinUpdates-93b82ff3-8e0b-48fb-a443-819b42f46029
  reject_list: $null
  reboot: False
  reboot_timeout: 1200
  accept_list: $null
  state: installed
  _operation: poll
  server_selection: default

My question is how come there is a 2nd trigger that are not part of my playbook?
Thanks.

This module is quite complex in how it runs essentially there are 2 modes that it runs with:

  • It starts the module to kick off the updates and returns a unique pipe name (_operation: start)
  • It will then repeatedly run the module multiple times to poll the output (_operation: poll)

As each poll operation uses the module runner it is seen as a distinct module invocation hence multiple event logs for this module. You'll find that there will most likely be more than 2 event logs for one invocation as

  • The polling can run over multiple operations so it can report the progress in realtime
  • After rebooting the module will then run again until no more updates are found