Reg: Service check and stop during windows update.

Hello All,

I am doing windows server patching for some of the windows servers on my environment.

Now i have a requirement in which i have to check a service if it exists and stop it before installing update/patch.

can someone please help me on this such that playbook should first check for the service, stop it and then go for windows patching.

Script i am using now for windows patch update:

- name: Windows Update
hosts: all
gather_facts: false
tasks:
- name: Running Windows Update
win_updates:
category_names: [‘SecurityUpdates’,‘CriticalUpdates’,‘UpdateRollups’, ‘Updates’, ‘DefinitionUpdates’]
reboot: yes

Thanks in advance

Create a new play before this one to do your pretask.