diff --git a/deployment/ceph-ansible/ceph-base.yaml b/deployment/ceph-ansible/ceph-base.yaml index f552c65db8..6f992feaff 100644 --- a/deployment/ceph-ansible/ceph-base.yaml +++ b/deployment/ceph-ansible/ceph-base.yaml @@ -532,7 +532,7 @@ outputs: ignore_errors: True - name: untar local backup of ceph-ansible fetch directory # unarchive module hit https://github.com/ansible/ansible/issues/35645 - shell: "/usr/bin/gtar --gzip --extract --no-overwrite-dir --file {{local_ceph_ansible_fetch_directory_backup}}/{{ceph_ansible_tarball_name}} -C {{playbook_dir}}/ceph-ansible/fetch_dir" + shell: "/usr/bin/gtar --gzip --extract --file {{local_ceph_ansible_fetch_directory_backup}}/{{ceph_ansible_tarball_name}} -C {{playbook_dir}}/ceph-ansible/fetch_dir" when: local_backup_file.stat.exists == True when: local_ceph_ansible_fetch_directory_backup != "" - block: # swift backup @@ -555,7 +555,7 @@ outputs: - curl_get_http_status.stdout != "404" # new deployment - name: unpack downloaded ceph-ansible fetch tarball to fetch directory # unarchive module hit https://github.com/ansible/ansible/issues/35645 - shell: "/usr/bin/gtar --gzip --extract --no-overwrite-dir --file /tmp/{{old_ceph_ansible_tarball_name}} -C {{playbook_dir}}/ceph-ansible/fetch_dir" + shell: "/usr/bin/gtar --gzip --extract --file /tmp/{{old_ceph_ansible_tarball_name}} -C {{playbook_dir}}/ceph-ansible/fetch_dir" when: - curl_get_http_status.changed - curl_get_http_status.stdout == "200" @@ -619,6 +619,11 @@ outputs: when: - outputs.changed - outputs.rc != 0 + - name: register contents of fetch_directory after ceph-ansible run + find: + paths: "{{playbook_dir}}/ceph-ansible/fetch_dir/" + recurse: true + register: ceph_ansible_fetch_dir_contents - name: create ceph-ansible fetch directory tarball in local backup archive: path: "{{playbook_dir}}/ceph-ansible/fetch_dir/*" @@ -626,7 +631,9 @@ outputs: exclude_path: - '{{playbook_dir}}/ceph-ansible/fetch_dir/fetch_dir' register: nested - when: local_ceph_ansible_fetch_directory_backup != "" + when: + - local_ceph_ansible_fetch_directory_backup != "" + - ceph_ansible_fetch_dir_contents.matched|int != 0 - block: # swift backup - name: create temporary ceph-ansible fetch directory tarball for swift backup archive: @@ -651,7 +658,9 @@ outputs: state: absent when: (curl_put_http_status.changed and (curl_put_http_status.stdout == "200" or curl_put_http_status.stdout == "201")) - when: local_ceph_ansible_fetch_directory_backup == "" + when: + - local_ceph_ansible_fetch_directory_backup == "" + - ceph_ansible_fetch_dir_contents.matched|int != 0 - name: remove nested broken path if exist file: state: absent