让我们考虑下面的伪代码ansible:
- 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"
是否有可能在ansible办?
阅读关于Ansible Blocks它们允许你在其他事之中做的东西,如文档:
- 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"