atelier se basant sur une adaptation de playbooks incomplets

This commit is contained in:
2023-02-19 17:32:46 +01:00
parent 7ec4def659
commit fb27b8c798
4 changed files with 63 additions and 17 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"