How can I search for this exact string using my example:

"exists": true

My when condition:

when: lg is search( "exists": true )

It errors out using "exists": true.



On Friday, August 26, 2022 at 9:27:53 AM UTC-5 Nitrous wrote:

> Thanks, but I have other tasks that depend on my when condition, so I need 
> to get it right.
>
> On Friday, August 26, 2022 at 9:22:37 AM UTC-5 [email protected] wrote:
>
>>
>> https://docs.ansible.com/ansible/latest/collections/ansible/windows/win_service_info_module.html
>>
>> On Fri, Aug 26, 2022 at 9:17 AM Nitrous <[email protected]> wrote:
>>
>>> Im trying to figure out a way, on how to make a condition exit, if a 
>>> service is running.
>>> If it isnt running, then install it.
>>>
>>> My play book looks like below:
>>>
>>> - name: Check if LogRhythm System Monitor service is installed
>>>   win_service:
>>>     name: lg
>>>   register: lg
>>>
>>> - ansible.builtin.debug:
>>>     #msg: "state: running found"
>>>     var: lg
>>>      #verbosity: 4
>>>   when: lg is search("runing")
>>>
>>> I purposely used the variable "runing" instead of "running", as for new 
>>> server builds, the service isnt installed and running, so it will install 
>>> it.
>>>
>>> But if the service is "running", how can I modify my existing when 
>>> condition to skip, if service is "running"?
>>>
>>> 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 view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/ansible-project/2ee1702e-48eb-4cde-b8d4-5bcc181b2443n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/ansible-project/2ee1702e-48eb-4cde-b8d4-5bcc181b2443n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
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/6d8f62f6-f7ca-478a-8ac9-703704f9a40fn%40googlegroups.com.

Reply via email to