This is what I do now. Ansible 1.4 has "failed_when". http://docs.ansible.com/ansible/playbooks_error_handling.html#controlling-what-defines-failure
- name: Confirm Automation Agent is running command: service mongodb-mms-automation-agent status register: agent_status failed_when: "'NOT' in agent_status.stdout" changed_when: False (Added "changed_when: False" to suppress "changed" status) On Saturday, June 4, 2016 at 2:52:10 AM UTC-7, Mike Fennemore wrote: > > Indeed it will. If that is a possibility then I add ignore_errors:true and > still register a variable for the result. The variable will then give you a > status and msg if the service fails. > On 03 Jun 2016 9:44 PM, "Johannes Kastl" <[email protected] <javascript:>> > wrote: > >> On 03.06.16 20:25 Mike Fennemore wrote: >> > You could use register: to register a variable for the result then use >> debug: var= <your registered variable>.<property you want> >> > >> But if starting the service fails, shouldn't ansible report the task >> as failed? >> >> Johannes >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "Ansible Project" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/ansible-project/-LMHCCDAn0w/unsubscribe >> . >> To unsubscribe from this group and all its topics, send an email to >> [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/5751DDFE.1070601%40ojkastl.de >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- 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/23d5d31e-bb21-4baa-a683-c52ff9268231%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
