TIL: Ansible block/rescue
Use block and rescue for error handling in Ansible:
1- block:
2 - name: Try something risky
3 command: might_fail
4 rescue:
5 - name: Handle failure
6 debug:
7 msg: "It failed, but we recovered"
Use block and rescue for error handling in Ansible:
1- block:
2 - name: Try something risky
3 command: might_fail
4 rescue:
5 - name: Handle failure
6 debug:
7 msg: "It failed, but we recovered"