After failed task on 99% of my server , the rest of the playbook is running only on the 1% servers that passed the tasks

10 views
Skip to first unread message

דודו דודו

unread,
Apr 20, 2020, 2:33:54 AM4/20/20
to Ansible Project
Hi , 
I have a main playbook that uses "include" to call other playbooks.

In one of the playbooks, I have 5 tasks. The second task falls on all my servers except for one server - From that point, the entire playbook (main) is running only on that server

1. If a task failed on a server - how can I stop the entire process
2. In my case, why the playbook continues to run only on the server that was passed the specific task?



- hosts:
- postgres1
- cloudera_manager
- worker
- master
- gw
- kafka
- repository
- kafka_master
become: true
vars_files:
- ./cloudera_environment.yml

tasks:

- name: update hostname
include: hostname-update.yml

- name: create maintenance user
include: create_maintenance_user.yml

- name: OS update for supporting cloudera best practice
In this playbook task number 2 is faild on all my servers except one server
    include: redhat7_bigdata_best_practice.yml                 Starting task 3 in till the end of the palybook all tasks are running on that
specific server
-
name: update repository file
include: update-yum-repo.yml

-
name: Install rpm packages
include: install-package.yml


## Install Openjdk 11 ##
- hosts:
- postgres1
- cloudera_manager
- worker
- master
- gw
- repository

become: true
vars_files:
- ./cloudera_environment.yml

tasks:

-
name: Install rpm packages
include: install-java11-package.yml

Stefan Hornburg (Racke)

unread,
Apr 20, 2020, 2:53:03 AM4/20/20
to ansible...@googlegroups.com
On 4/20/20 8:33 AM, דודו דודו wrote:
> Hi , 
> I have a main playbook that uses "include" to call other playbooks.
>
> In one of the playbooks, I have 5 tasks. The second task falls on all my servers except for one server - From that
> point, the entire playbook (main) is running only on that server

That's the normal procedure.

>
> 1. If a task failed on a server - how can I stop the entire process
> 2. In my case, why the playbook continues to run only on the server that was passed the specific task?
>

You can abort the whole process on a single failure with

any_errors_fatal: true

Documentation: https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-the-play

Regards
Racke
> --
> 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
> ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/384caf13-5c89-4edd-acbf-f10b70312f68%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/384caf13-5c89-4edd-acbf-f10b70312f68%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

signature.asc
Reply all
Reply to author
Forward
0 new messages