I am struggling with a proper way to remove a patch KB your method is 
failing for me

---
- name: Install all windows security and critical updates and wait 10 mins
  hosts: all
  become: false
  tasks:
 - name: uninstall kb
      win_shell: WUSA /uninstall /kb:{{ 5015811 }}  /quiet /norestart
      register: uninstall

Error:

ERROR! We were unable to read either as JSON nor YAML, these are the errors 
we got from each:
JSON: Expecting value: line 1 column 1 (char 0)
Syntax Error while loading YAML.
  did not find expected '-' indicator
The error appears to be in 
'/tmp/bwrap_180_6em4f0yx/awx_180_n9swe56o/project/winupdateuninstall.yml': 
line 7, column 7, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
     - name: uninstall kb
      win_shell: WUSA /uninstall /kb: "{{ 5015811 }}"  /quiet /norestart
      ^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:
    with_items:
      - {{ foo }}
Should be written as:
    with_items:
      - "{{ foo }}"
On Thursday, May 23, 2019 at 11:59:03 AM UTC+5:30 new_ansible wrote:

> Hello Jon,
>
> Thanks.
> I  worked but to restart the os after uninstall , i  am using this :
>
>     - name: uninstall kb
>       win_shell: WUSA /uninstall /kb:{{ kbno }}  /quiet /norestart
>       register: uninstall
>
>
>     - debug: var="uninstall"
>
>     - win_reboot:
>       when: uninstall.rc == 0
>       reboot_timeout: 1500
>       post_reboot_delay: 100
>
>
> if  the uninstall is  successful.
>
> Since without "  /quiet /norestart " the job was getting stuck as it  
> needed user input to whether restart or not at windows server side.
>
>
> Is there any better way to  handle the user input to restart if required 
> in playbook.
>
> Thanks!
>
> On Wed, May 22, 2019 at 10:00 PM 'J Hawkesworth' via Ansible Project <
> [email protected]> wrote:
>
>>
>> Hmm, I have not had to do this myself.  One thing you could try is using 
>> wusa, although I think you may well have to use 'become' on your task as I 
>> believe wusa won't run in a 'normal' ansible remote login
>>
>> - name: uninstall KB1234
>>   win_shell: wusa /uninstall /kb:1234
>>   become: yes
>>
>>
>> Hope this helps,
>>
>> Jon
>>
>> On Wednesday, May 22, 2019 at 11:36:39 AM UTC+1, new_ansible wrote:
>>>
>>> Hello All!
>>>
>>> I need to uninstall the windows install package with KB article with 
>>> help of  ansible.
>>> the  win_update is  not happy with 'absent'
>>>
>>> Please help.
>>>
>>> Thanks
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/13305499-fb6f-4797-ab77-43701448584f%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/13305499-fb6f-4797-ab77-43701448584f%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/37e3796f-13ce-4a15-9a45-538b0aea50c8n%40googlegroups.com.

Reply via email to