SSH Connection Error Playbook Continues

Hi,

I’d like to clarify some functionality. When running a playbook with multiple plays and one play can’t connect to a host, ansible displays an error:

PLAY [First Play] *********************************************

TASK [setup] *******************************************************************
fatal: [remote-host]: UNREACHABLE! => {“changed”: false, “msg”: “ERROR! SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue”, “unreachable”: true}

PLAY [Next Play] **********************************************

This is fine as the host can’t be connected however rather than stopping the playbook execution it continues. My question is:

  1. If the playbook can’t connect to a host shouldn’t it fail fast and stop?
  2. Or is this expected behaviour? In that it fails the first play as it can’t connect to the remote-host but then continues to the next play to see if that works.

If point 2) is true is there a setting to exit the whole playbook on this type or error?

Thanks,
Phill

The playbook will continue but not for plays/tasks that target “remote-host”. If you want your playbook to bail out immediately checkout http://docs.ansible.com/ansible/playbooks_delegation.html#maximum-failure-percentage

Thanks but that says it only aborts the play, not the other plays in the playbook.

Is there another setting that can abort the playbook on a host failure?

When a play is aborted in this fashion, it’s considered a fatal error to the entire ansible-playbook run. It’s a full dead stop.

What is your inventory ?