On Mon, 6 Apr 2020 14:10:18 -0700 (PDT)
דודו דודו <
dudu.c...@gmail.com> wrote:
> I'm checking ping on a few of my groups. I wish to abort the playbook if
> one of the IPs is not reachable
>
> - hosts:
> - postgres1
> - kafka
> - repository
> become: true
> gather_facts: False
> tasks:
> - name: Verify that all hosts are reachable
> ping:
Try this
- hosts:
- postgres1
- kafka
- repository
become: true
gather_facts: False
tasks:
- block:
- wait_for_connection:
timeout: 5
rescue:
- debug:
msg: "{{ inventory_hostname }} not available. End play."
- meta: end_play
- debug:
msg: All hosts available. Continue play.
- setup:
HTH,
-vlado