--- - name: check whether {{app}}_backup.tgz exists shell: cd {{root_dir}}/webapps/ && [ -f {{app}}_backup.tgz ] ignore_errors: true register: result - name: revert {{app}}_backup.tgz when: result is succeeded shell: cd {{root_dir}}/webapps/ && rm -rf {{app}} && tar zxf {{app}}_backup.tgz && rm -f {{app}}_backup.tgz