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.