Hello, thanks for reply.

I've two hosts in the play, and one of the hosts assert module doesnt
validate to true and fails. With any_errors_fatal command I expect the
playbook to stop on all hosts within the play. But in my case, the play
stops only on failed host, it continues with other host where assertions
passed.

Is this expected behaviour ?

On Tuesday, June 6, 2023, Kosala Atapattu <[email protected]> wrote:

> Yes any_errors_fatal is what you need: https://docs.ansible.
> com/ansible/latest/playbook_guide/playbooks_error_
> handling.html#aborting-on-the-first-error-any-errors-fatal
>
> When you say it doesn't seem to work, what does not seem to work?
>
> *Kosala*
>
>
>
>
> On Tue, Jun 6, 2023 at 2:07 AM [email protected] <
> [email protected]> wrote:
>
>> Hello,
>>
>> My playbook has several hosts, and I have some tasks with *assert *and *fail
>> *modules. How to do that if the task gets any fatal error in the play
>> within particular host - the whole play should is terminated ?
>>
>> I thought that playbook command *any_errors_fatal *would work, but seems
>> not.
>>
>> Is there any other way to make playbook stop if any of the hosts
>> experiences errors ?
>>
>> I see ansible has meta modules - there are some kind like end_play
>> module, maybe this one would work..
>>
>> Thank you.
>>
>> --
>> 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/87c9f759-872f-40b7-b80c-
>> 73f61817fb82n%40googlegroups.com
>> <https://groups.google.com/d/msgid/ansible-project/87c9f759-872f-40b7-b80c-73f61817fb82n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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/VjdgAcJWJzc/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/CAP7S5HawfBqkb4L1DjmZumHmJFw-
> Rtm8Fuh4t2JCuKmr_AE_-A%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAP7S5HawfBqkb4L1DjmZumHmJFw-Rtm8Fuh4t2JCuKmr_AE_-A%40mail.gmail.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/CAOrc2M9XhNiSe5ieGYMoonMU0gnScrp1fUv2YtzZdm4gy8sW_g%40mail.gmail.com.

Reply via email to