Great! Thanks.
This is what I ended up with:
- name: Check if Service Exists
stat: path=/etc/init.d/{{service_name}}
register: service_status
- name: Stop Service
service: name={{service_name}} state=stopped
when: service_status.stat.exists
register: service_stopped
On Tuesday, May 19, 2015 at 4:56:11 PM UTC+2, Brian Coca wrote:
>
> you can:
>
> - stat: /etc/init.d/my_service
> register: my_service
>
> and now make other tasks conditional on :
>
> when: my_service|exists
>
>
> --
> Brian Coca
>
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/f18a0f0f-f2d5-46f3-883d-01fc4ba49326%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.