Think it through .. what is the structure of the data in 'lg' after 
win_service? You have to learn to decipher structured data so you can learn how 
to reference it.

Walter
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123

On Aug 26, 2022, at 12:13 PM, Nitrous 
<[email protected]<mailto:[email protected]>> wrote:

Yes, its the same information I gathered previously.
I need to search for this string in my when condition:

"exists": true

How can I do that?

Thanks

On Friday, August 26, 2022 at 10:59:12 AM UTC-5 
[email protected]<http://nist.gov> wrote:
Please read the module page for a description of what is "registered" with 
win_service.

Walter
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123<tel:(202)%20355-4123>

On Aug 26, 2022, at 11:53 AM, Nitrous <[email protected]> wrote:

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<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.ansible.com%2Fansible%2Flatest%2Fcollections%2Fansible%2Fwindows%2Fwin_service_info_module.html&data=05%7C01%7Cwalter.rowe%40nist.gov%7C28accaa9f1ed4294651208da877ddbf9%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C637971271870175513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=t5sUb1JbFUbrinFYUuAtwL3TkKGuRIcHZH7d5MDy%2FJc%3D&reserved=0>

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://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2F2ee1702e-48eb-4cde-b8d4-5bcc181b2443n%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7C28accaa9f1ed4294651208da877ddbf9%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C637971271870175513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=tQrOsGoXVeiP2%2B87R5kysQeGFW%2BorV9LjWNkwqJRnpc%3D&reserved=0>.

--
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<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2F6d8f62f6-f7ca-478a-8ac9-703704f9a40fn%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7C28accaa9f1ed4294651208da877ddbf9%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C637971271870175513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=OHrYIOUjSlJTBGLvAV06iXOyZJj17UjsS9basDcsOmg%3D&reserved=0>.


--
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]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/75a60d25-a8aa-42af-b89e-b94c43725f88n%40googlegroups.com<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2F75a60d25-a8aa-42af-b89e-b94c43725f88n%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7C28accaa9f1ed4294651208da877ddbf9%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C637971271870175513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=U5kS8VSdO%2B87zTviUtP2N%2Fq5MWW5yZAsvAogH9RPCwk%3D&reserved=0>.

-- 
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/B636BE3B-21AE-4C8D-AA7E-EA6A2C1F31FB%40nist.gov.

Reply via email to