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