From 586361c56eccc3cb486e51f4304f0c3d6a561b7d Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Tue, 19 Sep 2023 22:01:32 +0200 Subject: [PATCH] sap_install_media_detect: handle SIGNATURE.SMF inside sapcar extraction task --- .../tasks/organize_files.yml | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/organize_files.yml b/roles/sap_install_media_detect/tasks/organize_files.yml index cc7019ad5..0d0c53833 100644 --- a/roles/sap_install_media_detect/tasks/organize_files.yml +++ b/roles/sap_install_media_detect/tasks/organize_files.yml @@ -132,14 +132,26 @@ - line_item.archive_type == 'rarexe' - line_item.extract_archive == 'y' +- name: SAP Install Media Detect - Organize all files - Create temp dir for sapcar archive files - {{ __sap_install_media_detect_software_main_directory }}/tmp_extract + ansible.builtin.file: + path: "{{ __sap_install_media_detect_software_main_directory }}/tmp_extract" + state: directory + owner: root + group: root + mode: '0755' + - name: SAP Install Media Detect - Organize all files - Extract sapcar archive files - ansible.builtin.command: >- + ansible.builtin.shell: >- {{ __sap_install_media_detect_fact_sapcar_path }} - -R {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.extraction_dir }} - -xvf {{ line_item.file }} + -R {{ __sap_install_media_detect_software_main_directory }}/tmp_extract + -xvf {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.file }} -manifest SIGNATURE.SMF + && extracted_dir=$(ls -d */) + && mv SIGNATURE.SMF $extracted_dir + && mkdir -p {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.extraction_dir }}/$extracted_dir + && mv $extracted_dir {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.extraction_dir }}/ args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}/tmp_extract" loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" loop_control: loop_var: line_item @@ -148,17 +160,10 @@ - line_item.archive_type == 'sapcar' - line_item.extract_archive == 'y' -- name: SAP Install Media Detect - Organize all files - Move SIGNATURE.SMF into subdir for SAP HANA non-export files - ansible.builtin.shell: | - extracted_dir=$(ls -d */) - mv SIGNATURE.SMF ${extracted_dir} - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}/{{ line_item.extraction_dir }}" - loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" - loop_control: - loop_var: line_item - when: - - line_item.sap_file_type is search("saphana") +- name: SAP Install Media Detect - Organize all files - Remove temp dir - {{ __sap_install_media_detect_software_main_directory }}/tmp_extract + ansible.builtin.file: + path: "{{ __sap_install_media_detect_software_main_directory }}/tmp_extract" + state: absent - name: SAP Install Media Detect - Organize all files - Copy certain files to 'sap_hana' directory ansible.builtin.copy: