You need to put your code in the tasks section of your playbook, e.g.:

---
- name: Restart a service
  gather_facts: false
  hosts: all
  tasks:
    - name: Restart a service
      win_service:
        name: LoadRunnerAgent
        state: restarted
...

If that doesn't work, what error or output do you get?


On Wednesday, 21 August 2019 00:35:00 UTC+1, Jyotsna Mehta wrote:
>
> Hello Jonathan,
>
> I am new at this -- This is what I have created so far
>
> ---
> - name: Restart a service
>   win_service:
>     name: LoadRunnerAgent
>     state: restarted
>     username: domain\user
>     password: pwd
>
>
>
> On Tuesday, August 20, 2019 at 3:33:37 PM UTC-4, Jonathan Lozada De La 
> Matta wrote:
>>
>> Jyotsna,
>>
>> Can you share what you have so far?
>>
>> On Tue, Aug 20, 2019 at 3:32 PM Jyotsna Mehta <[email protected]> 
>> wrote:
>>
>>> Can someone help me create a playbook that restarts windows based load 
>>> runner service on multiple windows servers?
>>>
>>> -- 
>>> 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/97af4b82-1033-48cd-bffd-ccf242f0bae3%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/ansible-project/97af4b82-1033-48cd-bffd-ccf242f0bae3%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>>
>> -- 
>>
>> Jonathan Cha'gara Lozada De La Matta 
>>
>> He / Him / His
>>
>> Red Hat <https://www.redhat.com> 
>>
>> Senior Automation Practice Consultant & Automation CoP Manager
>>
>> Join the Automation CoP! https://red.ht/autocop
>> @redhatjobs <https://twitter.com/redhatjobs>   redhatjobs 
>> <https://www.facebook.com/redhatjobs> @redhatjobs 
>> <https://instagram.com/redhatjobs>   
>> <https://www.redhat.com> 
>>  
>>
>>

-- 
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/419ec8b2-d97e-4af8-b33b-40fa34a3f358%40googlegroups.com.

Reply via email to