--- - 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"