mkdir ~/temp
➜ temp cat test.yml
- hosts: all
serial: 1
max_fail_percentage: 1
gather_facts: false
tasks:
- ping:
➜ temp cat inventory
[all]
unreachable
localhost
➜ temp ansible-playbook -i inventory test.yml -k
SSH password:
PLAY [all] ************************************************************************************************************************************************************************************
TASK [ping] ***********************************************************************************************************************************************************************************
fatal: [unreachable]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: ssh: Could not resolve hostname unreachable: Name or service not known", "unreachable": true}
PLAY RECAP ************************************************************************************************************************************************************************************
unreachable : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0
As you can see it does not continue with localhost, which will succeed if I revert the inventory order.
Regards,