Hi everyone. Good day.

When we have a regular task like creating a file, or something similar, we 
can use block and rescue to manage what happens in failure cases.

But can we do the same for the first task (connection) on a target and 
rescue using localhost?

What I would like to achieve is this.

---
- name: Converge
  hosts: all
  gather_facts: false

  tasks:
    - name: Some Block
      block:

        - name: Gather Facts
          ansible.builtin.gather_facts:

      rescue:
        - name: Error Report
          ansible.builtin.debug:
            msg: Hi, Im failed
          delegate_to: localhost

But when I try that it never goes to rescue Error Report. It ends right 
away.

Would you happen to have any idea?

PLAY RECAP 
*********************************************************************
server                 : ok=0    changed=0    unreachable=1    failed=0   
 skipped=0    rescued=0    ignored=0






-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c5a2a45c-8631-48dd-9838-c21ffab5287cn%40googlegroups.com.

Reply via email to