OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

win_update "msg": "error: MODULE FAILURE See stdout/stderr for the exact error"

  • Thread starter Thread starter user23562218
  • Start date Start date
U

user23562218

Guest
I'm trying to run windows updates using win_update with ansible. It's giving me an error but doesn't say what the error exactly is. I'm at a loss

Code:
ansible-playbook update.yml --tags install -vvvvvv 
ansible-playbook [core 2.16.3]   
config file = /etc/ansible/ansible.cfg   
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']   
ansible python module location = /usr/local/lib/python3.10/dist-packages/ansible   
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections   
executable location = /usr/local/bin/ansible-playbook   
python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (/usr/bin/python3)   
jinja version = 3.0.3  libyaml = False 
Using /etc/ansible/ansible.cfg as config file setting up inventory plugins Loading collection ansible.builtin from

update.yml

Code:
`  tasks:

  - name: Reboot if system has a large uptime
    win_reboot:
    when: initial_reboot and not ansible_check_mode
    tags:
    - never
    - reboot

  - block:
    - name: >
        {{ 'Install' if 'install' in ansible_run_tags else 'Search' }} updates
        {{ 'will automatically reboot' if 'reboot' in ansible_run_tags else 'no reboot' }}
      win_updates:
        category_names:
          - SecurityUpdates
          - CriticalUpdates
          - UpdateRollups
          - DefinitionUpdates
          - Updates
        reboot: "{{ 'yes' if 'reboot' in ansible_run_tags else 'no' }}"
        state: "{{ 'installed' if 'install' in ansible_run_tags else 'searched' }}"
      become: yes
      become_method: runas
      become_user: SYSTEM
      register: update_results
      tags:
      - never
      - install
      - check

    rescue:
    - name: Windows update failed?
      debug:
        msg: "error: {{ update_results.msg }}"
      when: update_results is failed and update_results.msg is defined
      tags:
      - always
    - name: Server had pending reboots?
      win_reboot:
      when:  not ansible_check_mode and
            update_results is failed and
            update_results.msg is search('A reboot is required')`
      tags:
          - never

Expected Result: updates completed on target host. But I'm facing this error:

Code:
File "/usr/local/lib/python3.10/dist-packages/ansible_collections/ansible/windows/plugins/action/win_updates.py", line 679, in run
    result = self._run_sync(task_vars, module_options, reboot, reboot_timeout)
File "/usr/local/lib/python3.10/dist-packages/ansible_collections/ansible/windows/plugins/action/win_updates.py", line 752, in _run_sync
    update_result = self._run_updates(task_vars, module_options)
File "/usr/local/lib/python3.10/dist-packages/ansible_collections/ansible/windows/plugins/action/win_updates.py", line 848, in _run_updates
    start_result = self._execute_win_updates(
File "/usr/local/lib/python3.10/dist-packages/ansible_collections/ansible/windows/plugins/action/win_updates.py", line 946, in _execute_win_updates
    raise _ReturnResultException(msg, exception=result.get('exception', None), **extra_result)

ansible_collections.ansible.windows.plugins.action.win_updates._ReturnResultException: MODULE FAILURE
See stdout/stderr for the exact error

fs01 | FAILED! => {
    "changed": false,
    "failed_update_count": 0,
    "filtered_updates": {},
    "found_update_count": 0,
    "installed_update_count": 0,
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 0,
    "updates": {}
}

i have successfully win_ping this host so i'm not quite sure where it is failing
<p>I'm trying to run windows updates using win_update with ansible. It's giving me an error but doesn't say what the error exactly is. I'm at a loss</p>
<pre><code>ansible-playbook update.yml --tags install -vvvvvv
ansible-playbook [core 2.16.3]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.10/dist-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible-playbook
python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (/usr/bin/python3)
jinja version = 3.0.3 libyaml = False
Using /etc/ansible/ansible.cfg as config file setting up inventory plugins Loading collection ansible.builtin from
</code></pre>
<p>update.yml</p>
<pre><code>` tasks:

- name: Reboot if system has a large uptime
win_reboot:
when: initial_reboot and not ansible_check_mode
tags:
- never
- reboot

- block:
- name: >
{{ 'Install' if 'install' in ansible_run_tags else 'Search' }} updates
{{ 'will automatically reboot' if 'reboot' in ansible_run_tags else 'no reboot' }}
win_updates:
category_names:
- SecurityUpdates
- CriticalUpdates
- UpdateRollups
- DefinitionUpdates
- Updates
reboot: "{{ 'yes' if 'reboot' in ansible_run_tags else 'no' }}"
state: "{{ 'installed' if 'install' in ansible_run_tags else 'searched' }}"
become: yes
become_method: runas
become_user: SYSTEM
register: update_results
tags:
- never
- install
- check

rescue:
- name: Windows update failed?
debug:
msg: "error: {{ update_results.msg }}"
when: update_results is failed and update_results.msg is defined
tags:
- always
- name: Server had pending reboots?
win_reboot:
when: not ansible_check_mode and
update_results is failed and
update_results.msg is search('A reboot is required')`
tags:
- never
</code></pre>
<p>Expected Result: updates completed on target host. But I'm facing this error:</p>
<pre class="lang-bash prettyprint-override"><code>File "/usr/local/lib/python3.10/dist-packages/ansible_collections/ansible/windows/plugins/action/win_updates.py", line 679, in run
result = self._run_sync(task_vars, module_options, reboot, reboot_timeout)
File "/usr/local/lib/python3.10/dist-packages/ansible_collections/ansible/windows/plugins/action/win_updates.py", line 752, in _run_sync
update_result = self._run_updates(task_vars, module_options)
File "/usr/local/lib/python3.10/dist-packages/ansible_collections/ansible/windows/plugins/action/win_updates.py", line 848, in _run_updates
start_result = self._execute_win_updates(
File "/usr/local/lib/python3.10/dist-packages/ansible_collections/ansible/windows/plugins/action/win_updates.py", line 946, in _execute_win_updates
raise _ReturnResultException(msg, exception=result.get('exception', None), **extra_result)

ansible_collections.ansible.windows.plugins.action.win_updates._ReturnResultException: MODULE FAILURE
See stdout/stderr for the exact error

fs01 | FAILED! => {
"changed": false,
"failed_update_count": 0,
"filtered_updates": {},
"found_update_count": 0,
"installed_update_count": 0,
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 0,
"updates": {}
}

</code></pre>
<p>i have successfully win_ping this host so i'm not quite sure where it is failing</p>
Continue reading...
 
Top