Skip to content

Commit

Permalink
sap_install_media_detect: amend task prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-freeman committed Jun 25, 2024
1 parent e01d630 commit 4c57cbd
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---

- name: SAP Install Media Detect - Prepare - Search known subdirectories - Initialize fact variables, phase 1b
- name: SAP Install Media Detect - Prepare - Move files to parent for known subdirs - Initialize fact variables, phase 1b
ansible.builtin.set_fact:
__sap_install_media_detect_fact_find_result_phase_1b: []

# If any files have been moved to non-extract subdirectories already, move them back to the top level, making the role idempotent
# Reason for noqa: When using pipefail and there is no result from the grep -v, this tail will fail but it should never fail
- name: SAP Install Media Detect - Prepare - Search known subdirectories - Find the relevant non-extract subdirectories # noqa risky-shell-pipe
- name: SAP Install Media Detect - Prepare - Move files to parent for known subdirs - Find the relevant non-extract subdirectories # noqa risky-shell-pipe
ansible.builtin.shell:
cmd: >
ls -d \
Expand All @@ -20,21 +20,21 @@
failed_when: false

# Reason for noqa: When using pipefail and there is no result from the grep -v, this tail will fail but it should never fail
- name: SAP Install Media Detect - Prepare - Search known subdirectories - Find existing extract subdirectories # noqa risky-shell-pipe
- name: SAP Install Media Detect - Prepare - Move files to parent for known subdirs - Find existing extract subdirectories # noqa risky-shell-pipe
ansible.builtin.shell: ls -d {{ __sap_install_media_detect_software_main_directory }}/*/ | grep '_extracted/$'
register: __sap_install_media_detect_register_subdirectories_phase_1b_extracted
changed_when: false
failed_when: false

- name: SAP Install Media Detect - Prepare - Search known subdirectories - Display the relevant non-extract subdirectories
- name: SAP Install Media Detect - Prepare - Move files to parent for known subdirs - Display the relevant non-extract subdirectories
ansible.builtin.debug:
var: __sap_install_media_detect_register_subdirectories_phase_1b.stdout_lines

- name: SAP Install Media Detect - Prepare - Search known subdirectories - Display existing extract subdirectories
- name: SAP Install Media Detect - Prepare - Move files to parent for known subdirs - Display existing extract subdirectories
ansible.builtin.debug:
var: __sap_install_media_detect_register_subdirectories_phase_1b_extracted.stdout_lines

- name: SAP Install Media Detect - Prepare - Search known subdirectories - Create list of all files one level below '{{ __sap_install_media_detect_software_main_directory }}'
- name: SAP Install Media Detect - Prepare - Move files to parent for known subdirs - Create list of all files one level below '{{ __sap_install_media_detect_software_main_directory }}'
ansible.builtin.find:
paths: "{{ line_item }}"
patterns: '*'
Expand All @@ -46,29 +46,29 @@
loop_var: line_item
register: __sap_install_media_detect_register_find_result_phase_1b

- name: SAP Install Media Detect - Prepare - Search known subdirectories - Set fact from find result, phase 1b
- name: SAP Install Media Detect - Prepare - Move files to parent for known subdirs - Set fact from find result, phase 1b
ansible.builtin.set_fact:
__sap_install_media_detect_fact_find_result_phase_1b: "{{ __sap_install_media_detect_fact_find_result_phase_1b + [item.1.path] }}"
with_subelements:
- "{{ __sap_install_media_detect_register_find_result_phase_1b.results }}"
- files

# Reason for noqa: Too much additional code required for determining if anything has changed or not
- name: SAP Install Media Detect - Prepare - Search known subdirectories - Move files back to '{{ __sap_install_media_detect_software_main_directory }}' # noqa no-changed-when
- name: SAP Install Media Detect - Prepare - Move files to parent for known subdirs - Move files back to '{{ __sap_install_media_detect_software_main_directory }}' # noqa no-changed-when
ansible.builtin.command: "mv {{ line_item }} {{ __sap_install_media_detect_software_main_directory }}/"
loop: "{{ __sap_install_media_detect_fact_find_result_phase_1b }}"
loop_control:
loop_var: line_item

- name: SAP Install Media Detect - Prepare - Search known subdirectories - Remove the relevant non-extract subdirectories
- name: SAP Install Media Detect - Prepare - Move files to parent for known subdirs - Remove the relevant non-extract subdirectories
ansible.builtin.file:
path: "{{ line_item }}"
state: absent
loop: "{{ __sap_install_media_detect_register_subdirectories_phase_1b.stdout_lines }}"
loop_control:
loop_var: line_item

- name: SAP Install Media Detect - Prepare - Search known subdirectories - Remove the extract subdirectories
- name: SAP Install Media Detect - Prepare - Move files to parent for known subdirs - Remove the extract subdirectories
ansible.builtin.file:
path: "{{ line_item }}"
state: absent
Expand Down

0 comments on commit 4c57cbd

Please sign in to comment.