Let's consider following pseudo-ansible code:
- name: "some long task which can hang
- command: "something"  
- timeout: 60s
- name: "catch in case of failure (in particularity timeout)"
- command: "some helpful debug command"
Is it possible to do in ansible?
Read the docs on Ansible Blocks They allow you to amongst other things do stuff like:
- block:
    - debug:
        msg: "This is a basic task that will run in the block"
  rescue:
    - debug:
        msg: "This task will only run if something fails in the main block
  always:
    - debug:
        msg: "This task always runs, irrespective of whether the tasks in the main block succeed or not"
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With