Merge "Added tar option to preserve metadata of existing fetch_dir"
This commit is contained in:
commit
234fafd631
|
@ -517,7 +517,7 @@ outputs:
|
||||||
ignore_errors: True
|
ignore_errors: True
|
||||||
- name: untar local backup of ceph-ansible fetch directory
|
- name: untar local backup of ceph-ansible fetch directory
|
||||||
# unarchive module hit https://github.com/ansible/ansible/issues/35645
|
# unarchive module hit https://github.com/ansible/ansible/issues/35645
|
||||||
shell: "/usr/bin/gtar --gzip --extract --file {{local_ceph_ansible_fetch_directory_backup}}/{{ceph_ansible_tarball_name}} -C {{playbook_dir}}/ceph-ansible/fetch_dir"
|
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"
|
||||||
when: local_backup_file.stat.exists == True
|
when: local_backup_file.stat.exists == True
|
||||||
when: local_ceph_ansible_fetch_directory_backup != ""
|
when: local_ceph_ansible_fetch_directory_backup != ""
|
||||||
- block: # swift backup
|
- block: # swift backup
|
||||||
|
@ -540,7 +540,7 @@ outputs:
|
||||||
- curl_get_http_status.stdout != "404" # new deployment
|
- curl_get_http_status.stdout != "404" # new deployment
|
||||||
- name: unpack downloaded ceph-ansible fetch tarball to fetch directory
|
- name: unpack downloaded ceph-ansible fetch tarball to fetch directory
|
||||||
# unarchive module hit https://github.com/ansible/ansible/issues/35645
|
# unarchive module hit https://github.com/ansible/ansible/issues/35645
|
||||||
shell: "/usr/bin/gtar --gzip --extract --file /tmp/{{old_ceph_ansible_tarball_name}} -C {{playbook_dir}}/ceph-ansible/fetch_dir"
|
shell: "/usr/bin/gtar --gzip --extract --no-overwrite-dir --file /tmp/{{old_ceph_ansible_tarball_name}} -C {{playbook_dir}}/ceph-ansible/fetch_dir"
|
||||||
when:
|
when:
|
||||||
- curl_get_http_status.changed
|
- curl_get_http_status.changed
|
||||||
- curl_get_http_status.stdout == "200"
|
- curl_get_http_status.stdout == "200"
|
||||||
|
@ -606,14 +606,20 @@ outputs:
|
||||||
- outputs.rc != 0
|
- outputs.rc != 0
|
||||||
- name: create ceph-ansible fetch directory tarball in local backup
|
- name: create ceph-ansible fetch directory tarball in local backup
|
||||||
archive:
|
archive:
|
||||||
path: "{{playbook_dir}}/ceph-ansible/fetch_dir"
|
path: "{{playbook_dir}}/ceph-ansible/fetch_dir/*"
|
||||||
dest: "{{local_ceph_ansible_fetch_directory_backup}}/{{ceph_ansible_tarball_name}}"
|
dest: "{{local_ceph_ansible_fetch_directory_backup}}/{{ceph_ansible_tarball_name}}"
|
||||||
|
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 != ""
|
||||||
- block: # swift backup
|
- block: # swift backup
|
||||||
- name: create temporary ceph-ansible fetch directory tarball for swift backup
|
- name: create temporary ceph-ansible fetch directory tarball for swift backup
|
||||||
archive:
|
archive:
|
||||||
path: "{{playbook_dir}}/ceph-ansible/fetch_dir"
|
path: "{{playbook_dir}}/ceph-ansible/fetch_dir/*"
|
||||||
dest: "/tmp/{{new_ceph_ansible_tarball_name}}"
|
dest: "/tmp/{{new_ceph_ansible_tarball_name}}"
|
||||||
|
exclude_path:
|
||||||
|
- '{{playbook_dir}}/ceph-ansible/fetch_dir/fetch_dir'
|
||||||
|
register: nested
|
||||||
- name: backup temporary ceph-ansible fetch directory tarball in swift
|
- name: backup temporary ceph-ansible fetch directory tarball in swift
|
||||||
shell: "curl -s -o /dev/null -w '%{http_code}' -X PUT -T /tmp/{{new_ceph_ansible_tarball_name}} \"{{ swift_put_url }}\""
|
shell: "curl -s -o /dev/null -w '%{http_code}' -X PUT -T /tmp/{{new_ceph_ansible_tarball_name}} \"{{ swift_put_url }}\""
|
||||||
register: curl_put_http_status
|
register: curl_put_http_status
|
||||||
|
@ -631,6 +637,14 @@ outputs:
|
||||||
when: (curl_put_http_status.changed and (curl_put_http_status.stdout == "200" or
|
when: (curl_put_http_status.changed and (curl_put_http_status.stdout == "200" or
|
||||||
curl_put_http_status.stdout == "201"))
|
curl_put_http_status.stdout == "201"))
|
||||||
when: local_ceph_ansible_fetch_directory_backup == ""
|
when: local_ceph_ansible_fetch_directory_backup == ""
|
||||||
|
- name: remove nested broken path if exist
|
||||||
|
file:
|
||||||
|
state: absent
|
||||||
|
path: "{{ item }}"
|
||||||
|
recurse: no
|
||||||
|
with_items:
|
||||||
|
- '{{ nested.missing }}'
|
||||||
|
when: (nested.missing|default([])|length > 0)
|
||||||
external_update_tasks:
|
external_update_tasks:
|
||||||
- when: step|int == 0
|
- when: step|int == 0
|
||||||
tags: ceph
|
tags: ceph
|
||||||
|
|
Loading…
Reference in New Issue