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/CAHN57wrQn_U1p4wni_EKg4p4b2gpCZ6p1e4_GAYpStupruEANA%40mail.gmail.com.
