mise au point solution

This commit is contained in:
2022-11-01 18:33:29 +01:00
parent 45f12dc83a
commit e464c238d5
3 changed files with 42 additions and 11 deletions

23
try_catch.yml Normal file
View File

@@ -0,0 +1,23 @@
---
- hosts: cibles
tasks:
- name: send and execute script
block:
- name: send script
copy:
src: bad.sh
dest: /tmp//bad.sh
mode: 0750
- name: execute script
command: /tmp//bad.sh
register: result
always:
- name: display result whatever happened previously
debug:
var: result
rescue:
- name: display only if one of task in block failed
debug:
msg: "Something bad happened"