Hello guys,
I'm trying to check if the server is still reachable with a block -rescue 
statement.
If the server is no longer available, the rescue statement should do 
something. 

This is basically the simple playbook:

---
- name: Verify if host is up 
  hosts: Server2
  gather_facts: no
#  ignore_unreachable: true
  become: true

  tasks:
    - block:
      - name: Ping the Server
        ping:
        ignore_unreachable: true
      rescue: 
      - debug:
          msg: "The Ping was not successful"
        ...

The problem is that Playbook aborts directly if the server is not available 
and does not execute the rescue statement. 
I tried the ignore_unreachable statement on all possible positions. I have 
also added the statement ignore_errors. 

If im doing it without block / rescue, it is working without any problems.

So the Question: Can the keyword "ignore_unreachable" not be used in a 
block - rescue statement?

-- 
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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/241a3d81-deae-460d-a7ac-b84400b1306bo%40googlegroups.com.

Reply via email to