Re: [ansible-project] terminate the whole play if any fatal errors on any host occurs

2023-06-07 Thread Edvinas Kairys
Last update (I think). So i managed to clarify the situation. Seems that the problem occurs only when i'm using roles with block/rescue options. Without it everything works smooth. For example: *Roles Playbook without block/rescue:- hosts: TEONET01A,TEONET01B* * gather_facts: false any_err

Re: [ansible-project] terminate the whole play if any fatal errors on any host occurs

2023-06-06 Thread Edvinas Kairys
checked again, problem with serial 1 is that it doesn't run tasks in parallel. so then i have same playbook which is not in roles it runs like this: *TASK [assert] **ok: [10.8.250.46]fatal:

Re: [ansible-project] terminate the whole play if any fatal errors on any host occurs

2023-06-06 Thread Edvinas Kairys
I havent mentioned, that im using roles, when thereis simple playbook - everything works as expected - it quits playbook after assertion fails. When using roles - the assertion fails - and the playbook continues only with the host, which had assertion passed. I think its a bug, but i will try seri

Re: [ansible-project] terminate the whole play if any fatal errors on any host occurs

2023-06-06 Thread Will McDonald
Hey Edvinas, As Kosala mentions, this should do what you want, however I think the specific piece of documentation to note is "Ansible *finishes the fatal task on all hosts in the current batch*". With 2 hosts, and the default of 5 forks, your batch size will be 5 so your play will carry on across

Re: [ansible-project] terminate the whole play if any fatal errors on any host occurs

2023-06-06 Thread Kosala Atapattu (කෝසල අතපත්තු)
The doc says it should do what you’re after.If you set any_errors_fatal and a task returns an error, Ansible finishes the fatal task on all hosts in the current batch, then stops executing the play on all hosts. Subsequent tasks and plays are not executed. You can recover from fatal errors by addin

Re: [ansible-project] terminate the whole play if any fatal errors on any host occurs

2023-06-05 Thread Edvinas Kairys
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 wher

Re: [ansible-project] terminate the whole play if any fatal errors on any host occurs

2023-06-05 Thread Kosala Atapattu
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 edvina...@gmail.co

[ansible-project] terminate the whole play if any fatal errors on any host occurs

2023-06-05 Thread edvina...@gmail.com
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.