- name: "create backup_dest_path" file: path: "{{ backup_dest_path }}" state: directory ignore_errors: true - name: "tsg_env_{{ uninstall_version }}_{{ date }}.zip exist?" shell: "ls {{ backup_dest_path }}/tsg_env_{{ uninstall_version }}_{{ date }}.zip" register: tsgenv_directory ignore_errors: true - name: "backup /opt/tsg/env to destination path" archive: path: /opt/tsg/env dest: "{{ backup_dest_path }}/tsg_env_{{ uninstall_version }}_{{ date }}.zip" format: zip when: - tsgenv_directory.rc != 0 - backup.tsg_env == 1 ignore_errors: true