--- - name: upload {{app}}.zip copy: src=/var/transfer/{{app}}.zip dest={{root_dir}}/webapps/{{app}}.zip - name: check whether {{app}}.war exists shell: cd {{root_dir}}/webapps/ && [ -f {{app}}.war ] ignore_errors: true register: result - name: remove old {{app}}.war.bak shell: cd {{root_dir}}/webapps/ && rm -rf {{app}}.war.bak {{app}} - name: create current {{app}}.war.bak when: result is succeeded shell: cd {{root_dir}}/webapps/ && mv {{app}}.war {{app}}.war.bak - name: unzip new {{app}}.zip shell: cd {{root_dir}}/webapps/ && unzip -o -qq {{app}}.zip && rm -f {{app}}.zip