diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ac14c5a94..8cae9cc30 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,21 @@ community.sap_install Release Notes .. contents:: Topics +v1.3.1 +====== + +Release Summary +--------------- + +| Release Date: 2023-08-14 +| sap_ha_pacemaker_cluster: Improved AWS constructs based on feedback +| sap_ha_pacemaker_cluster: Improved no STONITH resource definition handling +| sap_hana_install: Bug fix for arg spec on deprecated vars +| sap_hostagent: Bug fix for media handling +| sap_install_media_detect: Improved handling based on feedback +| sap_storage_setup: Bug fix for existing storage devices +| sap_swpm: Make full log output optional and replace with sapcontrol log final status +| collection: Bug fix for sample Ansible Playbooks v1.3.0 ====== diff --git a/README.md b/README.md index 22041e047..db49c28ce 100644 --- a/README.md +++ b/README.md @@ -95,25 +95,29 @@ There are various methods to execute the Ansible Collection, dependant on the us | ---- | ---- | ---- | | Ansible Playbook
-> source Ansible Collection
-> execute Ansible Task
--> run Ansible Role
---> run Ansible Module for Shell (built-in)
---> ... | Complex executions with various interlinked activities;
run in parallel or sequentially | Localhost or Remote | -## Requirements, Dependencies and Testing +## Testing, Requirements and Dependencies -## Testing with SAP Software Provisioning Manager (SWPM) +### Testing Various SAP Software solutions have been extensively tested: - SAP HANA -- SAP NetWeaver AS (ABAP or JAVA) -- SAP S/4HANA AnyPremise 1809, 1909, 2020, 2021 - - One Host installation - - Dual Host installation + - Scale-Up + - Scale-Out + - High Availability +- SAP NetWeaver AS (ABAP or JAVA) and additional addons (e.g. GRC, ADS) +- SAP S/4HANA AnyPremise (1809, 1909, 2020, 2021, 2022) + - Sandbox (One Host) installation + - Standard (Dual Host) installation - Distributed installation - High Availability installation - System Copy (Homogeneous with SAP HANA Backup / Recovery) installation + - Maintenance Planner installation - System Rename - SAP BW/4HANA +- SAP Business Suite on HANA (SoH, i.e. SAP ECC on HANA) +- SAP Business Suite (i.e. SAP ECC with SAP AnyDB - SAP ASE, SAP MaxDB, IBM Db2, Oracle DB) - SAP Solution Manager 7.2 -- SAP Business Suite (i.e. ECC) -- SAP NetWeaver applications (e.g. GRC) - SAP Web Dispatcher ### Target host - Operating System requirements @@ -136,7 +140,7 @@ N.B. The Ansible Collection works with SLES from version 15 SP3 and upwards, for Execution of Ansible Playbooks using this Ansible Collection have been tested with: - Python 3.9.7 and above (i.e. CPython distribution) -- Ansible Core 2.11.5 and above (included with optional installation of Ansible Community Edition 4.0 and above) +- Ansible Core 2.11.5 and above _(included with optional installation of Ansible Community Edition 4.0 and above)_ - OS: macOS with Homebrew, RHEL, SLES, and containers in Task Runners (e.g. Azure DevOps) ## License diff --git a/galaxy.yml b/galaxy.yml index 45d526643..9f4417e77 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -10,7 +10,7 @@ namespace: community name: sap_install # The version of the collection. Must be compatible with semantic versioning -version: 1.3.0 +version: 1.3.1 # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md diff --git a/playbooks/vars/sample-variables-sap-swpm-advanced-mode-s4hana-onehost-install.yml b/playbooks/vars/sample-variables-sap-swpm-advanced-mode-s4hana-onehost-install.yml index de9130313..74511ff45 100644 --- a/playbooks/vars/sample-variables-sap-swpm-advanced-mode-s4hana-onehost-install.yml +++ b/playbooks/vars/sample-variables-sap-swpm-advanced-mode-s4hana-onehost-install.yml @@ -1,7 +1,7 @@ --- # Detect SAP HANA and SAP NetWeaver software -sap_install_media_detect_directory: "/software" +sap_install_media_detect_source_directory: "/software" sap_install_media_detect_source: local_dir sap_install_media_detect_swpm: true sap_install_media_detect_hostagent: true diff --git a/playbooks/vars/sample-variables-sap-swpm-advanced-templates-mode.yml b/playbooks/vars/sample-variables-sap-swpm-advanced-templates-mode.yml index 98d1b61ac..3a78f204b 100644 --- a/playbooks/vars/sample-variables-sap-swpm-advanced-templates-mode.yml +++ b/playbooks/vars/sample-variables-sap-swpm-advanced-templates-mode.yml @@ -2,7 +2,7 @@ # Detect SAP HANA and SAP NetWeaver software # Set vars: on each Ansible Task depending on chosen template -sap_install_media_detect_directory: "/software" +sap_install_media_detect_source_directory: "/software" sap_install_media_detect_source: local_dir #sap_install_media_detect_swpm: true #sap_install_media_detect_hostagent: true diff --git a/playbooks/vars/sample-variables-sap-swpm-default-mode-bw4hana-onehost-install.yml b/playbooks/vars/sample-variables-sap-swpm-default-mode-bw4hana-onehost-install.yml index 7e68405ae..3a79a2a28 100644 --- a/playbooks/vars/sample-variables-sap-swpm-default-mode-bw4hana-onehost-install.yml +++ b/playbooks/vars/sample-variables-sap-swpm-default-mode-bw4hana-onehost-install.yml @@ -1,7 +1,7 @@ --- # Detect SAP HANA and SAP NetWeaver software -sap_install_media_detect_directory: "/software" +sap_install_media_detect_source_directory: "/software" sap_install_media_detect_source: local_dir sap_install_media_detect_swpm: true sap_install_media_detect_hostagent: true diff --git a/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-ascs-install.yml b/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-ascs-install.yml index ca0e37761..a39c9c1aa 100644 --- a/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-ascs-install.yml +++ b/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-ascs-install.yml @@ -1,7 +1,7 @@ --- # Detect SAP NetWeaver software -sap_install_media_detect_directory: "/software" +sap_install_media_detect_source_directory: "/software" sap_install_media_detect_source: local_dir sap_install_media_detect_swpm: true sap_install_media_detect_hostagent: true diff --git a/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-dbload-install.yml b/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-dbload-install.yml index 44fcf69d0..08d27d15f 100644 --- a/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-dbload-install.yml +++ b/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-dbload-install.yml @@ -1,7 +1,7 @@ --- # Detect SAP NetWeaver software -sap_install_media_detect_directory: "/software" +sap_install_media_detect_source_directory: "/software" sap_install_media_detect_source: local_dir sap_install_media_detect_swpm: true sap_install_media_detect_hostagent: true diff --git a/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-ers-install.yml b/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-ers-install.yml index 094e7b8f7..3a053ff2a 100644 --- a/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-ers-install.yml +++ b/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-ers-install.yml @@ -1,7 +1,7 @@ --- # Detect SAP NetWeaver software -sap_install_media_detect_directory: "/software" +sap_install_media_detect_source_directory: "/software" sap_install_media_detect_source: local_dir sap_install_media_detect_swpm: true sap_install_media_detect_hostagent: true diff --git a/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-pas-install.yml b/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-pas-install.yml index 414285f8a..49379bf5e 100644 --- a/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-pas-install.yml +++ b/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-pas-install.yml @@ -1,7 +1,7 @@ --- # Detect SAP NetWeaver software -sap_install_media_detect_directory: "/software" +sap_install_media_detect_source_directory: "/software" sap_install_media_detect_source: local_dir sap_install_media_detect_swpm: true sap_install_media_detect_hostagent: true diff --git a/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-onehost-install.yml b/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-onehost-install.yml index ffe0bd345..d8e5cdf73 100644 --- a/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-onehost-install.yml +++ b/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-onehost-install.yml @@ -1,7 +1,7 @@ --- # Detect SAP HANA and SAP NetWeaver software -sap_install_media_detect_directory: "/software" +sap_install_media_detect_source_directory: "/software" sap_install_media_detect_source: local_dir sap_install_media_detect_swpm: true sap_install_media_detect_hostagent: true diff --git a/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-onehost-restore.yml b/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-onehost-restore.yml index 2706037ce..1ec025002 100644 --- a/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-onehost-restore.yml +++ b/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-onehost-restore.yml @@ -1,7 +1,7 @@ --- # Detect SAP HANA and SAP NetWeaver software -sap_install_media_detect_directory: "/software" +sap_install_media_detect_source_directory: "/software" sap_install_media_detect_source: local_dir sap_install_media_detect_swpm: true sap_install_media_detect_hostagent: true diff --git a/playbooks/vars/sample-variables-sap-swpm-default-mode-solman-hana-abap-onehost-install.yml b/playbooks/vars/sample-variables-sap-swpm-default-mode-solman-hana-abap-onehost-install.yml index 7e017b89f..d1d9c10e0 100644 --- a/playbooks/vars/sample-variables-sap-swpm-default-mode-solman-hana-abap-onehost-install.yml +++ b/playbooks/vars/sample-variables-sap-swpm-default-mode-solman-hana-abap-onehost-install.yml @@ -1,7 +1,7 @@ --- # Detect SAP HANA and SAP NetWeaver software -sap_install_media_detect_directory: "/software" +sap_install_media_detect_source_directory: "/software" sap_install_media_detect_source: local_dir sap_install_media_detect_db: "saphana" sap_install_media_detect_swpm: true diff --git a/playbooks/vars/sample-variables-sap-swpm-default-mode-solman-hana-java-onehost-install.yml b/playbooks/vars/sample-variables-sap-swpm-default-mode-solman-hana-java-onehost-install.yml index 96e9a8116..6014fe636 100644 --- a/playbooks/vars/sample-variables-sap-swpm-default-mode-solman-hana-java-onehost-install.yml +++ b/playbooks/vars/sample-variables-sap-swpm-default-mode-solman-hana-java-onehost-install.yml @@ -1,7 +1,7 @@ --- # Detect SAP HANA and SAP NetWeaver software -sap_install_media_detect_directory: "/software" +sap_install_media_detect_source_directory: "/software" sap_install_media_detect_source: local_dir sap_install_media_detect_db: "saphana" sap_install_media_detect_swpm: true diff --git a/playbooks/vars/sample-variables-sap-swpm-default-mode-webdisp-standalone-install.yml b/playbooks/vars/sample-variables-sap-swpm-default-mode-webdisp-standalone-install.yml index d9f7b48d2..346d4aabf 100644 --- a/playbooks/vars/sample-variables-sap-swpm-default-mode-webdisp-standalone-install.yml +++ b/playbooks/vars/sample-variables-sap-swpm-default-mode-webdisp-standalone-install.yml @@ -1,7 +1,7 @@ --- # Detect SAP HANA and SAP NetWeaver software -sap_install_media_detect_directory: "/software" +sap_install_media_detect_source_directory: "/software" sap_install_media_detect_source: local_dir sap_install_media_detect_swpm: true sap_install_media_detect_hostagent: true diff --git a/playbooks/vars/sample-variables-sap-swpm-default-templates-mode.yml b/playbooks/vars/sample-variables-sap-swpm-default-templates-mode.yml index ac5bfc753..bfeafde97 100644 --- a/playbooks/vars/sample-variables-sap-swpm-default-templates-mode.yml +++ b/playbooks/vars/sample-variables-sap-swpm-default-templates-mode.yml @@ -2,7 +2,7 @@ # Detect SAP HANA and SAP NetWeaver software # Set vars: on each Ansible Task depending on chosen template -sap_install_media_detect_directory: "/software" +sap_install_media_detect_source_directory: "/software" sap_install_media_detect_source: local_dir #sap_install_media_detect_swpm: true #sap_install_media_detect_hostagent: true diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml index 726792c9b..0c87c43bf 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml @@ -2,6 +2,33 @@ # The following variables are constructed here in order to be provided as # input for the included 'ha_cluster' system role. +- name: "SAP HA Prepare Pacemaker - Block when no STONITH resource is defined" + when: + - sap_ha_pacemaker_cluster_stonith_default is not defined + or sap_ha_pacemaker_cluster_stonith_default | length == 0 + - sap_ha_pacemaker_cluster_stonith_custom is not defined + or sap_ha_pacemaker_cluster_stonith_custom | length == 0 + block: + + - name: "SAP HA Prepare Pacemaker - Set STONITH to disabled when no fencing resource is defined" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_cluster_properties: + - attrs: + - name: stonith-enabled + value: false + + - name: "SAP HA Prepare Pacemaker - Warn that there is no STONITH configured" + ansible.builtin.pause: + seconds: 5 + prompt: | + + WARNING: No STONITH resource is defined and STONITH is disabled! + + Recommendation: Add a STONITH resource and set cluster property + "stonith-enabled=true" + before using this cluster for production services. +# END of block + - name: "SAP HA Prepare Pacemaker - Define cluster stonith properties" when: - sap_ha_pacemaker_cluster_cluster_properties is defined @@ -40,7 +67,7 @@ __sap_ha_pacemaker_cluster_stonith_resource: "{{ __sap_ha_pacemaker_cluster_stonith_resource | default([]) + [__stonith_resource_element] }}" vars: __stonith_resource_element: - id: "res_{{ sap_ha_pacemaker_cluster_stonith_default.id }}" + id: "{{ sap_ha_pacemaker_cluster_stonith_default.id }}" agent: "{{ sap_ha_pacemaker_cluster_stonith_default.agent }}" instance_attrs: - attrs: |- @@ -50,7 +77,7 @@ 'name': 'pcmk_host_map', 'value': __sap_ha_pacemaker_cluster_pcmk_host_map }]) -%} - {%- for agent_opt in (sap_ha_pacemaker_cluster_stonith_default.options | dict2items) -%} + {%- for agent_opt in (sap_ha_pacemaker_cluster_stonith_default.options | default({}) | dict2items) -%} {% set aopts = attrs.extend([ { 'name': agent_opt.key, @@ -63,7 +90,7 @@ 'name': fence_opt.key, 'value': fence_opt.value }]) -%} - {%- endfor %} + {%- endfor %} {{ attrs }} - name: "SAP HA Prepare Pacemaker - Assemble the stonith resources from custom definition" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/main.yml b/roles/sap_ha_pacemaker_cluster/tasks/main.yml index 6b8361fd1..e05a72ea4 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/main.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/main.yml @@ -107,6 +107,19 @@ vars: __sap_ha_pacemaker_cluster_platform_file: "{{ role_path }}/tasks/{{ item }}" + # Stop and disable services that conflict with cluster setups, + # for instance cloud-init services on cloud platforms + - name: "SAP HA Install Pacemaker - Stop and disable services" + when: sap_ha_pacemaker_cluster_disable_services is defined + ansible.builtin.service: + name: "{{ service_item }}" + enabled: false + state: stopped + loop: "{{ sap_ha_pacemaker_cluster_disable_services }}" + loop_control: + loop_var: service_item + label: "{{ service_item }}" + # Before we are ready to call the ha_cluster role, we want to validate # that the minimum required parameters are defined and not empty. # TODO: make this smarter, currently all these vars are pre-defined anyway diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/include_vars_platform.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/include_vars_platform.yml index c7bf0176c..6a1ad95f8 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/include_vars_platform.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/include_vars_platform.yml @@ -13,47 +13,47 @@ # pcmk_host_map format: :;:... - name: "SAP HA Prepare Pacemaker - AWS EC2 VS - Assemble host mapping" ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_pcmk_host_map: > + __sap_ha_pacemaker_cluster_pcmk_host_map: |- {% for node in ansible_play_hosts_all -%} {{ hostvars[node].ansible_hostname }}:{{ hostvars[node].ansible_board_asset_tag }} - {%- if not loop.last %};{% endif -%} - {%- endfor %} + {%- if not loop.last %};{% endif %} + {% endfor %} when: __sap_ha_pacemaker_cluster_platform == "cloud_aws_ec2_vs" - name: "SAP HA Prepare Pacemaker - IBM Power VS from IBM Cloud - Set variable for fencing agent" ansible.builtin.set_fact: sap_ha_pacemaker_cluster_ibmcloud_powervs_host_guid: "{{ __sap_ha_pacemaker_cluster_register_ibmcloud_powervs_host }}" - when: __sap_ha_pacemaker_cluster_platform == "" + when: __sap_ha_pacemaker_cluster_platform == "cloud_ibmcloud_powervs" # pcmk_host_map format: :;:... - name: "SAP HA Prepare Pacemaker - IBM Power VS from IBM Cloud - Assemble host mapping" ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_pcmk_host_map: >- + __sap_ha_pacemaker_cluster_pcmk_host_map: |- {% for node in ansible_play_hosts_all -%} {{ hostvars[node].ansible_hostname }}:{{ hostvars[node].sap_ha_pacemaker_cluster_ibmcloud_powervs_host_guid }} - {%- if not loop.last %};{%- endif -%} - {%- endfor %} + {%- if not loop.last %};{% endif %} + {% endfor %} when: __sap_ha_pacemaker_cluster_platform == "cloud_ibmcloud_powervs" # pcmk_host_map format: :;:... - name: "SAP HA Prepare Pacemaker - IBM Cloud VS - Assemble host mapping" ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_pcmk_host_map: >- + __sap_ha_pacemaker_cluster_pcmk_host_map: |- {% for node in ansible_play_hosts_all -%} {{ hostvars[node].ansible_hostname }}:{{ hostvars[node].__sap_ha_pacemaker_cluster_register_ibmcloud_vs_host.stdout }} - {%- if not loop.last %};{%- endif -%} - {%- endfor %} + {%- if not loop.last %};{% endif %} + {% endfor %} when: __sap_ha_pacemaker_cluster_platform == "cloud_ibmcloud_vs" # pcmk_host_map format: :;:... - name: "SAP HA Prepare Pacemaker - MS Azure VM - Assemble host mapping" ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_pcmk_host_map: >- + __sap_ha_pacemaker_cluster_pcmk_host_map: |- {% for node in ansible_play_hosts_all -%} {{ hostvars[node].ansible_hostname }}:{{ hostvars[node].ansible_hostname }} - {%- if not loop.last %};{%- endif -%} - {%- endfor %} + {%- if not loop.last %};{% endif %} + {% endfor %} when: __sap_ha_pacemaker_cluster_platform == "cloud_msazure_vm" diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml index 9f226fb13..e4b555b9b 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml @@ -16,13 +16,16 @@ __sap_ha_pacemaker_cluster_repos: # Predefine __sap_ha_pacemaker_cluster_aws_instances: [] +# When aws credentials and region are not defined it will +# default to using the aws cli configuration. +# aws cli is configured by default for the VIP resource. sap_ha_pacemaker_cluster_stonith_default: id: "res_fence_aws" agent: "stonith:fence_aws" - options: - access_key: "{{ sap_ha_pacemaker_cluster_aws_access_key_id }}" - secret_key: "{{ sap_ha_pacemaker_cluster_aws_secret_access_key }}" - region: "{{ sap_ha_pacemaker_cluster_aws_region }}" +# options: +# access_key: "{{ sap_ha_pacemaker_cluster_aws_access_key_id }}" +# secret_key: "{{ sap_ha_pacemaker_cluster_aws_secret_access_key }}" +# region: "{{ sap_ha_pacemaker_cluster_aws_region }}" # Platform specific VIP handling sap_ha_pacemaker_cluster_vip_method: aws_vpc_move_ip @@ -41,3 +44,10 @@ __sap_ha_pacemaker_cluster_available_vip_agents: # Supported agent to manage Virtual/Overlay IPs for SAP on AWS by updating VPC Routing Table. aws_vpc_move_ip: agent: "ocf:heartbeat:aws-vpc-move-ip" + +# RHEL 8.6 and later: +# Services that must be disabled and stopped for the VIP to work +# otherwise AWS cloud-init keeps deleting the IP +sap_ha_pacemaker_cluster_disable_services: + - nm-cloud-setup.timer + - nm-cloud-setup diff --git a/roles/sap_hana_install/meta/argument_specs.yml b/roles/sap_hana_install/meta/argument_specs.yml index da6e26f14..6fbc34bed 100644 --- a/roles/sap_hana_install/meta/argument_specs.yml +++ b/roles/sap_hana_install/meta/argument_specs.yml @@ -6,10 +6,8 @@ argument_specs: sap_hana_install_sid: description: HANA SID type: str # str, list, dict, bool, int, float, path, raw, jsonarg, json, bytes, bits - required: true - no_log: true + required: false sap_hana_install_number: description: HANA Instance Number type: str # str, list, dict, bool, int, float, path, raw, jsonarg, json, bytes, bits - required: true - no_log: true + required: false diff --git a/roles/sap_hostagent/tasks/deploy_sar_remote.yml b/roles/sap_hostagent/tasks/deploy_sar_remote.yml index c2c1e1391..b4936a193 100644 --- a/roles/sap_hostagent/tasks/deploy_sar_remote.yml +++ b/roles/sap_hostagent/tasks/deploy_sar_remote.yml @@ -2,8 +2,8 @@ - name: Extract the SAPHOSTAGENT archive using SAPCAR command: >- - {{ sap_hostagent_sar_remote_path }}/{{ sap_hostagent_sapcar_file_name }} \ - -xvf {{ sap_hostagent_sapcar_remote_path }}/{{ sap_hostagent_sar_file_name }} -manifest SIGNATURE.SMF + {{ sap_hostagent_sapcar_remote_path }}/{{ sap_hostagent_sapcar_file_name }} \ + -xvf {{ sap_hostagent_sar_remote_path }}/{{ sap_hostagent_sar_file_name }} -manifest SIGNATURE.SMF register: extractagent args: chdir: "{{ sap_hostagent_agent_tmp_directory }}" @@ -14,4 +14,4 @@ register: installagent args: chdir: "{{ sap_hostagent_agent_tmp_directory }}" - changed_when: "'Install service' in installagent.stdout" \ No newline at end of file + changed_when: "'Install service' in installagent.stdout" diff --git a/roles/sap_install_media_detect/defaults/main.yml b/roles/sap_install_media_detect/defaults/main.yml index 0c954261a..3c57ea55e 100644 --- a/roles/sap_install_media_detect/defaults/main.yml +++ b/roles/sap_install_media_detect/defaults/main.yml @@ -1,5 +1,7 @@ --- +# Set this parameter to use either the unar package from EPEL or another software package for handling RAR files. +# Based on this setting, the commands for listing and extracting RAR files are being set in tasks/prepare/enable_rar_handling.yml sap_install_media_detect_rar_package: 'EPEL' #sap_install_media_detect_rar_package: 'linux-rar' @@ -10,13 +12,6 @@ sap_install_media_detect_epel_gpg_key_url: "https://download.fedoraproject.org/p # For using the rpm -e command, set this variable to 'false'. sap_install_media_detect_use_rpm_key_module_for_removing_the_key: true -# commands for handling rar files -sap_install_media_detect_rar_list: '/usr/bin/lsar' -sap_install_media_detect_rar_extract: '/usr/bin/unar' - -#sap_install_media_detect_rar_list: '/usr/bin/unrar lb' -#sap_install_media_detect_rar_extract: '/usr/bin/unrar x' - # If this role is running on a file server on which the SAP software is not to be installed, set the following to true. # If this role is running on a system on which the SAP software is to be installed, set the following to false. sap_install_media_detect_file_server_only: false @@ -24,18 +19,23 @@ sap_install_media_detect_file_server_only: false # Directory where the SAP software is located sap_install_media_detect_source_directory: /software +# Directory where the SAP software is located after the role is run, if different from sap_install_media_detect_source_directory +#sap_install_media_detect_target_directory: /software_local + # If there are two files of the same RAR or ZIP type, one with and one without suffix, the following parameter will determine what # the role will do for such a file: skip the file renaming, fail, or overwrite the file with the suffix by the file without suffix sap_install_media_detect_rename_target_file_exists: 'skip' #sap_install_media_detect_rename_target_file_exists: 'fail' #sap_install_media_detect_rename_target_file_exists: 'overwrite' -# Directory where the SAP software is located after the role is run, if different from sap_install_media_detect_source_directory -#sap_install_media_detect_target_directory: /software_local - # local_dir, remote_dir (e.g. NFS, s3fuse) #sap_install_media_detect_source: local_dir +# If the following parameter is set to true and the target directory for the extracted files (= *_extracted) already exists, +# the extraction of the corresponding file will be skipped. If set to false, target directories will be removed initially, +# forcing a fresh extraction, including re-creation of the target directory. +sap_install_media_detect_skip_extraction_if_target_dir_exists: false + # saphana, sapase, sapmaxdb, oracledb, ibmdb2 sap_install_media_detect_db: "saphana" diff --git a/roles/sap_install_media_detect/tasks/detect_backup_saphana.yml b/roles/sap_install_media_detect/tasks/detect_backup_saphana.yml index 0258688e0..fa7c90219 100644 --- a/roles/sap_install_media_detect/tasks/detect_backup_saphana.yml +++ b/roles/sap_install_media_detect/tasks/detect_backup_saphana.yml @@ -3,8 +3,8 @@ - name: Identify SAP HANA Backup files ansible.builtin.find: paths: "{{ sap_install_media_detect_backup_directory }}" - recurse: yes + recurse: true file_type: directory patterns: '.*COMPLETE.*' - use_regex: yes + use_regex: true register: backup_saphana_find_dir diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapbw4hana.yml b/roles/sap_install_media_detect/tasks/detect_export_sapbw4hana.yml index 26748cf71..8695a57c0 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapbw4hana.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapbw4hana.yml @@ -13,10 +13,10 @@ - name: SAP Install Media Detect - SAP BW/4HANA EXPORT - Identify SAP BW/4HANA EXPORT files ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}" - recurse: yes + recurse: true file_type: file patterns: '.*BW4.*EXPORT.*' - use_regex: yes + use_regex: true register: bw4hana_export_files - name: SAP Install Media Detect - SAP BW/4HANA EXPORT - Local Directory source - move SAP BW/4HANA EXPORT files diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml b/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml index 7d9cbe103..63350993c 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml @@ -1,5 +1,17 @@ --- +- name: SAP Install Media Detect - SAP ECC EXPORT - Get info of directory 'sapecc_export_extracted' + ansible.builtin.stat: + path: "{{ __sap_install_media_detect_software_main_directory }}/sapecc_export_extracted/" + register: __sap_install_media_detect_sapecc_export_extracted_stat + +- name: SAP Install Media Detect - SAP ECC EXPORT - Ensure directory 'sapecc_export_extracted' is absent + ansible.builtin.file: + path: "{{ __sap_install_media_detect_software_main_directory }}/sapecc_export_extracted/" + state: absent + when: + - not sap_install_media_detect_skip_extraction_if_target_dir_exists + - name: SAP Install Media Detect - SAP ECC EXPORT - Create Directories ansible.builtin.file: path: "{{ item }}" @@ -12,7 +24,7 @@ - "{{ __sap_install_media_detect_software_main_directory }}/sapecc_export_extracted/" - name: SAP Install Media Detect - SAP ECC EXPORT - List files in directory - ansible.builtin.command: ls -1 + ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" @@ -38,10 +50,18 @@ ignore_errors: true changed_when: false -- name: SAP Install Media Detect - SAP ECC EXPORT - Identify SAP ECC EXPORT files +# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 +- name: SAP Install Media Detect - SAP ECC EXPORT - Identify SAP ECC EXPORT files # noqa risky-shell-pipe ansible.builtin.shell: | - set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXPORT_' ; then echo '{{ item }}' ; fi ; - elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/EXPORT_' ; then echo '{{ item }}' ; fi ; fi + if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then + if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXPORT_'; then + echo '{{ item }}' + fi + elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then + if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/EXPORT_'; then + echo '{{ item }}' + fi + fi register: detect_directory_files_ecc_export changed_when: "item | length > 0" with_items: @@ -57,35 +77,32 @@ - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" - -# Reason for noqa: Difficult to determine the change status in the shell command sequence -#- name: SAP Install Media Detect - SAP ECC EXPORT - If any RAR without file extension, then add file extension # noqa no-changed-when -# ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi -# with_items: -# - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" -# args: -# chdir: "{{ __sap_install_media_detect_software_main_directory }}" + when: (not __sap_install_media_detect_sapecc_export_extracted_stat.stat.exists) or + ( __sap_install_media_detect_sapecc_export_extracted_stat.stat.exists and not + sap_install_media_detect_skip_extraction_if_target_dir_exists) # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP ECC EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP ECC Installation Export files # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then eval "{{ sap_install_media_detect_rar_extract }}" "{{ item }}" sapecc_export_extracted/ ; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then eval "{{ sap_install_media_detect_rar_extract }}" "{{ item }}{{ sap_install_media_detect_rar_extract_argument }}" sapecc_export_extracted/ ; fi with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" + when: (not __sap_install_media_detect_sapecc_export_extracted_stat.stat.exists) or + ( __sap_install_media_detect_sapecc_export_extracted_stat.stat.exists and not + sap_install_media_detect_skip_extraction_if_target_dir_exists) - name: SAP Install Media Detect - SAP ECC EXPORT - Identify SAP ECC Export extracted ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/sapecc_export_extracted" - recurse: yes + recurse: true file_type: directory -# contains: "DATA_UNITS" patterns: '.*DATA_UNITS.*' - use_regex: yes + use_regex: true register: detect_directory_export_extracted - name: SAP Install Media Detect - SAP ECC EXPORT - Local Directory source - re-list files in directory - ansible.builtin.command: ls -1 + ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" @@ -117,10 +134,18 @@ when: - sap_install_media_detect_source == "local_dir" -- name: SAP Install Media Detect - SAP ECC EXPORT - Local Directory source - re-identify SAP ECC EXPORT files +# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 +- name: SAP Install Media Detect - SAP ECC EXPORT - Local Directory source - re-identify SAP ECC EXPORT files # noqa risky-shell-pipe ansible.builtin.shell: | - set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXPORT_' ; then echo '{{ item }}' ; fi ; - elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/EXPORT_' ; then echo '{{ item }}' ; fi ; fi + if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then + if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXPORT_' ; then + echo '{{ item }}' + fi + elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then + if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/EXPORT_'; then + echo '{{ item }}' + fi + fi register: detect_directory_files_ecc_export_repeated changed_when: "item | length > 0" with_items: diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml b/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml index 078b7f049..9279586bf 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml @@ -1,5 +1,17 @@ --- +- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Get info of directory 'sapecc_ides_export_extracted' + ansible.builtin.stat: + path: "{{ __sap_install_media_detect_software_main_directory }}/sapecc_ides_export_extracted/" + register: __sap_install_media_detect_sapecc_ides_export_extracted_stat + +- name: SAP Install Media Detect - SAP ECC IDES EXPORT- Ensure directory 'sapecc_ides_export_extracted' is absent + ansible.builtin.file: + path: "{{ __sap_install_media_detect_software_main_directory }}/sapecc_ides_export_extracted/" + state: absent + when: + - not sap_install_media_detect_skip_extraction_if_target_dir_exists + - name: SAP Install Media Detect - SAP ECC IDES EXPORT - Create Directories ansible.builtin.file: path: "{{ item }}" @@ -12,7 +24,7 @@ - "{{ __sap_install_media_detect_software_main_directory }}/sapecc_ides_export_extracted/" - name: SAP Install Media Detect - SAP ECC IDES EXPORT - List files in directory - ansible.builtin.command: ls -1 + ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" @@ -38,10 +50,18 @@ ignore_errors: true changed_when: false -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Identify SAP ECC IDES EXPORT files +# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 +- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Identify SAP ECC IDES EXPORT files # noqa risky-shell-pipe ansible.builtin.shell: | - set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -Eq '*EXP[0-9]' ; then echo '{{ item }}' ; fi ; - elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -Eq '*EXP[0-9]' ; then echo '{{ item }}' ; fi ; fi + if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then + if zipinfo -1 {{ item }} | grep -Eq '*EXP[0-9]'; then + echo '{{ item }}' + fi + elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then + if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -Eq '*EXP[0-9]'; then + echo '{{ item }}' + fi + fi register: detect_directory_files_ecc_export changed_when: "item | length > 0" with_items: @@ -57,35 +77,32 @@ - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" - -# Reason for noqa: Difficult to determine the change status in the shell command sequence -#- name: SAP Install Media Detect - SAP ECC IDES EXPORT - If any RAR without file extension, then add file extension # noqa no-changed-when -# ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi -# with_items: -# - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" -# args: -# chdir: "{{ __sap_install_media_detect_software_main_directory }}" + when: (not __sap_install_media_detect_sapecc_ides_export_extracted_stat.stat.exists) or + ( __sap_install_media_detect_sapecc_ides_export_extracted_stat.stat.exists and not + sap_install_media_detect_skip_extraction_if_target_dir_exists) # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP ECC IDES EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP ECC Installation Export files # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then eval "{{ sap_install_media_detect_rar_extract }}" "{{ item }}" sapecc_ides_export_extracted/ ; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then eval "{{ sap_install_media_detect_rar_extract }}" "{{ item }}{{ sap_install_media_detect_rar_extract_argument }}" sapecc_ides_export_extracted/ ; fi with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" + when: (not __sap_install_media_detect_sapecc_ides_export_extracted_stat.stat.exists) or + ( __sap_install_media_detect_sapecc_ides_export_extracted_stat.stat.exists and not + sap_install_media_detect_skip_extraction_if_target_dir_exists) - name: SAP Install Media Detect - SAP ECC IDES EXPORT - Identify SAP ECC IDES EXPORT extracted ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/sapecc_ides_export_extracted" - recurse: yes + recurse: true file_type: directory -# contains: "*EXP" patterns: '.*EXP.*' - use_regex: yes + use_regex: true register: detect_directory_export_extracted - name: SAP Install Media Detect - SAP ECC IDES EXPORT - Local Directory source - re-list files in directory - ansible.builtin.command: ls -1 + ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" @@ -117,10 +134,18 @@ when: - sap_install_media_detect_source == "local_dir" -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Local Directory source - re-identify SAP ECC IDES EXPORT files +# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 +- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Local Directory source - re-identify SAP ECC IDES EXPORT files # noqa risky-shell-pipe ansible.builtin.shell: | - set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -Eq '*EXP[0-9]' ; then echo '{{ item }}' ; fi ; - elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -Eq '*EXP[0-9]' ; then echo '{{ item }}' ; fi ; fi + if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then + if zipinfo -1 {{ item }} | grep -Eq '*EXP[0-9]'; then + echo '{{ item }}' + fi + elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then + if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -Eq '*EXP[0-9]'; then + echo '{{ item }}' + fi + fi register: detect_directory_files_ecc_export_repeated changed_when: "item | length > 0" with_items: diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml index 3439f0ea6..f9ba5a410 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml @@ -1,6 +1,18 @@ --- -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Create Directories +- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Get info of directory 'sapnwas_abap_export_extracted' + ansible.builtin.stat: + path: "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_abap_export_extracted/" + register: __sap_install_media_detect_sapnwas_abap_export_extracted_stat + +- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Ensure directory 'sapnwas_abap_export_extracted' is absent + ansible.builtin.file: + path: "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_abap_export_extracted/" + state: absent + when: + - not sap_install_media_detect_skip_extraction_if_target_dir_exists + +- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Ensure directories exist ansible.builtin.file: path: "{{ item }}" state: directory @@ -12,7 +24,7 @@ - "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_abap_export_extracted/" - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - List files in directory - ansible.builtin.command: ls -1 + ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" @@ -38,10 +50,18 @@ ignore_errors: true changed_when: no -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Identify EXPORT files +# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 +- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Identify EXPORT files # noqa risky-shell-pipe ansible.builtin.shell: | - set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; - elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; fi + if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then + if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXP'; then + echo '{{ item }}' + fi + elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then + if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/EXP'; then + echo '{{ item }}' + fi + fi register: detect_directory_files_nwas_abap_export changed_when: "item | length > 0" with_items: @@ -57,35 +77,32 @@ - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" - -# Reason for noqa: Difficult to determine the change status in the shell command sequence -#- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - If any RAR without file extension, then add file extension # noqa no-changed-when -# ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi -# with_items: -# - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" -# args: -# chdir: "{{ __sap_install_media_detect_software_main_directory }}" + when: (not __sap_install_media_detect_sapnwas_abap_export_extracted_stat.stat.exists) or + ( __sap_install_media_detect_sapnwas_abap_export_extracted_stat.stat.exists and not + sap_install_media_detect_skip_extraction_if_target_dir_exists) # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP NetWeaver (ABAP) Installation Export files # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then eval "{{ sap_install_media_detect_rar_extract }}" "{{ item }}" sapnwas_abap_export_extracted/ ; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then eval "{{ sap_install_media_detect_rar_extract }}" "{{ item }}{{ sap_install_media_detect_rar_extract_argument }}" sapnwas_abap_export_extracted/ ; fi with_items: - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" + when: (not __sap_install_media_detect_sapnwas_abap_export_extracted_stat.stat.exists) or + ( __sap_install_media_detect_sapnwas_abap_export_extracted_stat.stat.exists and not + sap_install_media_detect_skip_extraction_if_target_dir_exists) - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Identify EXPORT extracted ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_abap_export_extracted" - recurse: yes + recurse: true file_type: directory -# contains: "DATA_UNITS" patterns: '.*DATA_UNITS.*' - use_regex: yes + use_regex: true register: detect_directory_export_extracted - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Local Directory source - re-list files in directory - ansible.builtin.command: ls -1 + ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" @@ -117,10 +134,18 @@ when: - sap_install_media_detect_source == "local_dir" -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Local Directory source - re-identify EXPORT files +# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 +- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Local Directory source - re-identify EXPORT files # noqa risky-shell-pipe ansible.builtin.shell: | - set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; - elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; fi + if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then + if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXP'; then + echo '{{ item }}' + fi + elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then + if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/EXP'; then + echo '{{ item }}' + fi + fi register: detect_directory_files_nwas_abap_export_repeated changed_when: "item | length > 0" with_items: diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml index 2075d2ccf..141681a35 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml @@ -1,5 +1,17 @@ --- +- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Get info of directory 'sapnwas_java_export_extracted' + ansible.builtin.stat: + path: "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_java_export_extracted/" + register: __sap_install_media_detect_sapnwas_java_export_extracted_stat + +- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Ensure directory 'sapnwas_java_export_extracted' is absent + ansible.builtin.file: + path: "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_java_export_extracted/" + state: absent + when: + - not sap_install_media_detect_skip_extraction_if_target_dir_exists + - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Create Directories ansible.builtin.file: path: "{{ item }}" @@ -12,7 +24,7 @@ - "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_java_export_extracted/" - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - List files in directory - ansible.builtin.command: ls -1 + ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" @@ -38,10 +50,18 @@ ignore_errors: true changed_when: false -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Identify EXPORT files +# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 +- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Identify EXPORT files # noqa risky-shell-pipe ansible.builtin.shell: | - set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP' ; then echo '{{ item }}' ; fi ; - elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP' ; then echo '{{ item }}' ; fi ; fi + if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then + if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP'; then + echo '{{ item }}' + fi + elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then + if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP'; then + echo '{{ item }}' + fi + fi register: detect_directory_files_nwas_java_export changed_when: "item | length > 0" with_items: @@ -57,35 +77,32 @@ - "{{ detect_directory_files_nwas_java_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" - -# Reason for noqa: Difficult to determine the change status in the shell command sequence -#- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - If any RAR without file extension, then add file extension # noqa no-changed-when -# ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi -# with_items: -# - "{{ detect_directory_files_nwas_java_export.results | map(attribute='stdout') | select() }}" -# args: -# chdir: "{{ __sap_install_media_detect_software_main_directory }}" + when: (not __sap_install_media_detect_sapnwas_java_export_extracted_stat.stat.exists) or + ( __sap_install_media_detect_sapnwas_java_export_extracted_stat.stat.exists and not + sap_install_media_detect_skip_extraction_if_target_dir_exists) # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP NetWeaver (JAVA) Installation Export files # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then eval "{{ sap_install_media_detect_rar_extract }}" "{{ item }}" sapnwas_java_export_extracted/ ; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then eval "{{ sap_install_media_detect_rar_extract }}" "{{ item }}{{ sap_install_media_detect_rar_extract_argument }}" sapnwas_java_export_extracted/ ; fi with_items: - "{{ detect_directory_files_nwas_java_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" + when: (not __sap_install_media_detect_sapnwas_java_export_extracted_stat.stat.exists) or + ( __sap_install_media_detect_sapnwas_java_export_extracted_stat.stat.exists and not + sap_install_media_detect_skip_extraction_if_target_dir_exists) - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Identify EXPORT extracted ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_java_export_extracted" - recurse: yes + recurse: true file_type: directory -# contains: "DATA_UNITS" patterns: '.*DATA_UNITS.*' - use_regex: yes + use_regex: true register: detect_directory_export_extracted - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Local Directory source - re-list files in directory - ansible.builtin.command: ls -1 + ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" @@ -117,10 +134,18 @@ when: - sap_install_media_detect_source == "local_dir" -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Local Directory source - re-identify EXPORT files +# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 +- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Local Directory source - re-identify EXPORT files # noqa risky-shell-pipe ansible.builtin.shell: | - set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP' ; then echo '{{ item }}' ; fi ; - elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP' ; then echo '{{ item }}' ; fi ; fi + if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then + if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP'; then + echo '{{ item }}' + fi + elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then + if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP'; then + echo '{{ item }}' + fi + fi register: detect_directory_files_nwas_java_export_repeated changed_when: "item | length > 0" with_items: diff --git a/roles/sap_install_media_detect/tasks/detect_export_saps4hana.yml b/roles/sap_install_media_detect/tasks/detect_export_saps4hana.yml index 9a038d01f..a427327bc 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_saps4hana.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_saps4hana.yml @@ -13,10 +13,10 @@ - name: SAP Install Media Detect - SAP S/4HANA EXPORT - Identify SAP S/4HANA EXPORT files ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}" - recurse: yes + recurse: true file_type: file patterns: '.*S4.*EXPORT.*' - use_regex: yes + use_regex: true register: s4hana_export_files - name: SAP Install Media Detect - SAP S/4HANA EXPORT - Local Directory source - move SAP S/4HANA EXPORT files diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml b/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml index 350ac098a..7d88dae0d 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml @@ -1,5 +1,17 @@ --- +- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Get info of directory 'sapsolman_abap_export_extracted' + ansible.builtin.stat: + path: "{{ __sap_install_media_detect_software_main_directory }}/sapsolman_abap_export_extracted/" + register: __sap_install_media_detect_sapsolman_abap_export_extracted_stat + +- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Ensure directory 'sapsolman_abap_export_extracted' is absent + ansible.builtin.file: + path: "{{ __sap_install_media_detect_software_main_directory }}/sapsolman_abap_export_extracted/" + state: absent + when: + - not sap_install_media_detect_skip_extraction_if_target_dir_exists + - name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Create Directories ansible.builtin.file: path: "{{ item }}" @@ -12,7 +24,7 @@ - "{{ __sap_install_media_detect_software_main_directory }}/sapsolman_abap_export_extracted/" - name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - List files in directory - ansible.builtin.command: ls -1 + ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" @@ -28,9 +40,10 @@ ignore_errors: true changed_when: false -- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Identify EXPORT files +# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 +- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Identify EXPORT files # noqa risky-shell-pipe ansible.builtin.shell: | - set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; fi + if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_nwas_abap_export changed_when: "item | length > 0" with_items: @@ -45,19 +58,21 @@ - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" + when: (not __sap_install_media_detect_sapsolman_abap_export_extracted_stat.stat.exists) or + ( __sap_install_media_detect_sapsolman_abap_export_extracted_stat.stat.exists and not + sap_install_media_detect_skip_extraction_if_target_dir_exists) - name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Identify EXPORT extracted ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/sapsolman_abap_export_extracted" - recurse: yes + recurse: true file_type: directory -# contains: "DATA_UNITS" patterns: '.*DATA_UNITS.*' - use_regex: yes + use_regex: true register: detect_directory_export_extracted - name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Local Directory source - re-list files in directory - ansible.builtin.command: ls -1 + ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" @@ -77,9 +92,10 @@ when: - sap_install_media_detect_source == "local_dir" -- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Local Directory source - re-identify EXPORT files +# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 +- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Local Directory source - re-identify EXPORT files # noqa risky-shell-pipe ansible.builtin.shell: | - set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; fi + if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_nwas_abap_export_repeated changed_when: "item | length > 0" with_items: diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml index 16a1b58d8..3f5d54fe1 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml @@ -1,5 +1,41 @@ --- +- name: SAP Install Media Detect - IBM Db2 - Get info of directory 'ibmdb2_extracted' + ansible.builtin.stat: + path: "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_extracted/" + register: __sap_install_media_detect_ibmdb2_extracted_stat + +- name: SAP Install Media Detect - IBM Db2 - Ensure directory 'ibmdb2_extracted' is absent + ansible.builtin.file: + path: "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_extracted/" + state: absent + when: + - not sap_install_media_detect_skip_extraction_if_target_dir_exists + +- name: SAP Install Media Detect - IBM Db2 - Get info of directory 'ibmdb2_client_extracted' + ansible.builtin.stat: + path: "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_client_extracted/" + register: __sap_install_media_detect_ibmdb2_client_extracted_stat + +- name: SAP Install Media Detect - IBM Db2 - Ensure directory 'ibmdb2_client_extracted' is absent + ansible.builtin.file: + path: "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_client_extracted/" + state: absent + when: + - not sap_install_media_detect_skip_extraction_if_target_dir_exists + +- name: SAP Install Media Detect - IBM Db2 - Get info of directory 'ibmdb2_license_extracted' + ansible.builtin.stat: + path: "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_license_extracted/" + register: __sap_install_media_detect_ibmdb2_license_extracted_stat + +- name: SAP Install Media Detect - IBM Db2 - Ensure directory 'ibmdb2_license_extracted' is absent + ansible.builtin.file: + path: "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_license_extracted/" + state: absent + when: + - not sap_install_media_detect_skip_extraction_if_target_dir_exists + - name: SAP Install Media Detect - IBM Db2 - Create Directories ansible.builtin.file: path: "{{ item }}" @@ -14,7 +50,7 @@ - "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_license_extracted/" - name: SAP Install Media Detect - IBM Db2 - List files in directory - ansible.builtin.command: ls -1 + ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" @@ -30,9 +66,10 @@ ignore_errors: true changed_when: false -- name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 installation media +# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 +- name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 installation media # noqa risky-shell-pipe ansible.builtin.shell: | - set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'db2setup' ; then echo '{{ item }}' ; fi ; fi + if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'db2setup' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_ibmdb2 changed_when: "item | length > 0" with_items: @@ -40,9 +77,10 @@ args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" -- name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 Client installation media +# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 +- name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 Client installation media # noqa risky-shell-pipe ansible.builtin.shell: | - set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'db6_update_client.sh' ; then echo '{{ item }}' ; fi ; fi + if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'db6_update_client.sh' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_ibmdb2_client changed_when: "item | length > 0" with_items: @@ -50,9 +88,10 @@ args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" -- name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 OEM license file +# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 +- name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 OEM license file # noqa risky-shell-pipe ansible.builtin.shell: | - set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'db2aese_c.lic' ; then echo '{{ item }}' ; fi ; fi + if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'db2aese_c.lic' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_ibmdb2_license changed_when: "item | length > 0" with_items: @@ -67,6 +106,9 @@ - "{{ detect_directory_files_ibmdb2.results | map(attribute='stdout') | select() }}" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" + when: (not __sap_install_media_detect_ibmdb2_extracted_stat.stat.exists) or + ( __sap_install_media_detect_ibmdb2_extracted_stat.stat.exists and not + sap_install_media_detect_skip_extraction_if_target_dir_exists) # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - IBM Db2 - Extract ZIP files of IBM DB2 Client installation media # noqa no-changed-when @@ -75,6 +117,9 @@ - "{{ detect_directory_files_ibmdb2_client.results | map(attribute='stdout') | select() }}" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" + when: (not __sap_install_media_detect_ibmdb2_client_extracted_stat.stat.exists) or + ( __sap_install_media_detect_ibmdb2_client_extracted_stat.stat.exists and not + sap_install_media_detect_skip_extraction_if_target_dir_exists) # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - IBM Db2 - Extract ZIP files of IBM DB2 OEM license file # noqa no-changed-when @@ -83,21 +128,26 @@ - "{{ detect_directory_files_ibmdb2_license.results | map(attribute='stdout') | select() }}" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" + when: (not __sap_install_media_detect_ibmdb2_license_extracted_stat.stat.exists) or + ( __sap_install_media_detect_ibmdb2_license_extracted_stat.stat.exists and not + sap_install_media_detect_skip_extraction_if_target_dir_exists) - name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 extracted ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_extracted" - recurse: yes + recurse: true file_type: directory - contains: "LINUXX86_64" + patterns: ".*LINUXX86_64.*" + use_regex: true register: detect_directory_ibmdb2_extracted - name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 Client extracted ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_client_extracted" - recurse: yes + recurse: true file_type: directory - contains: "DATA_UNITS" + patterns: ".*DATA_UNITS.*" + use_regex: true register: detect_directory_ibmdb2_client_extracted - name: SAP Install Media Detect - IBM Db2 - Local Directory source - move IBM Db2 compressed archive files diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml index 8ad6a37c7..55ace690f 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml @@ -1,5 +1,29 @@ --- +- name: SAP Install Media Detect - Oracle DB - Get info of directory 'oracledb_extracted' + ansible.builtin.stat: + path: "{{ __sap_install_media_detect_software_main_directory }}/oracledb_extracted/" + register: __sap_install_media_detect_oracledb_extracted_stat + +- name: SAP Install Media Detect - Oracle DB - Ensure directory 'oracledb_extracted' is absent + ansible.builtin.file: + path: "{{ __sap_install_media_detect_software_main_directory }}/oracledb_extracted/" + state: absent + when: + - not sap_install_media_detect_skip_extraction_if_target_dir_exists + +- name: SAP Install Media Detect - Oracle DB - Get info of directory 'oracledb_client_extracted' + ansible.builtin.stat: + path: "{{ __sap_install_media_detect_software_main_directory }}/oracledb_client_extracted/" + register: __sap_install_media_detect_oracledb_client_extracted_stat + +- name: SAP Install Media Detect - Oracle DB - Ensure directory 'oracledb_client_extracted' is absent + ansible.builtin.file: + path: "{{ __sap_install_media_detect_software_main_directory }}/oracledb_client_extracted/" + state: absent + when: + - not sap_install_media_detect_skip_extraction_if_target_dir_exists + - name: SAP Install Media Detect - Oracle DB - Create Directories ansible.builtin.file: path: "{{ item }}" @@ -13,7 +37,7 @@ - "{{ __sap_install_media_detect_software_main_directory }}/oracledb_client_extracted/" - name: SAP Install Media Detect - Oracle DB - List files in directory - ansible.builtin.command: ls -1 + ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" @@ -29,9 +53,10 @@ ignore_errors: true changed_when: false -- name: SAP Install Media Detect - Oracle DB - Identify Oracle DB installation media +# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 +- name: SAP Install Media Detect - Oracle DB - Identify Oracle DB installation media # noqa risky-shell-pipe ansible.builtin.shell: | - set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q '19cinstall.sh' ; then echo '{{ item }}' ; fi ; fi + if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q '19cinstall.sh' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_oracledb changed_when: "item | length > 0" with_items: @@ -39,9 +64,10 @@ args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" -- name: SAP Install Media Detect - Oracle DB - Identify Oracle DB Client installation media +# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 +- name: SAP Install Media Detect - Oracle DB - Identify Oracle DB Client installation media # noqa risky-shell-pipe ansible.builtin.shell: | - set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'OCL_LINUX_X86_64' ; then echo '{{ item }}' ; fi ; fi + if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'OCL_LINUX_X86_64' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_oracledb_client changed_when: "item | length > 0" with_items: @@ -56,6 +82,9 @@ - "{{ detect_directory_files_oracledb.results | map(attribute='stdout') | select() }}" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" + when: (not __sap_install_media_detect_oracledb_extracted_stat.stat.exists) or + ( __sap_install_media_detect_oracledb_extracted_stat.stat.exists and not + sap_install_media_detect_skip_extraction_if_target_dir_exists) # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - Oracle DB - Extract ZIP files of Oracle DB Client installation media # noqa no-changed-when @@ -64,21 +93,26 @@ - "{{ detect_directory_files_oracledb_client.results | map(attribute='stdout') | select() }}" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" + when: (not __sap_install_media_detect_oracledb_client_extracted_stat.stat.exists) or + ( __sap_install_media_detect_oracledb_client_extracted_stat.stat.exists and not + sap_install_media_detect_skip_extraction_if_target_dir_exists) - name: SAP Install Media Detect - Oracle DB - Identify Oracle DB extracted ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/oracledb_extracted" - recurse: yes + recurse: true file_type: directory - contains: "LINUX_X86_64" + patterns: ".*LINUX_X86_64.*" + use_regex: true register: detect_directory_oracledb_extracted - name: SAP Install Media Detect - Oracle DB - Identify Oracle DB Client extracted ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/oracledb_client_extracted" - recurse: yes + recurse: true file_type: directory - contains: "OCL_LINUX_X86_64" + patterns: ".*OCL_LINUX_X86_64.*" + use_regex: true register: detect_directory_oracledb_client_extracted - name: SAP Install Media Detect - Oracle DB - Local Directory source - move Oracle DB compressed archive files diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml index ea172d636..7ffb0825c 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml @@ -1,5 +1,17 @@ --- +- name: SAP Install Media Detect - SAP ASE - Get info of directory 'sapase_extracted' + ansible.builtin.stat: + path: "{{ __sap_install_media_detect_software_main_directory }}/sapase_extracted/" + register: __sap_install_media_detect_sapase_extracted_stat + +- name: SAP Install Media Detect - SAP ASE - Ensure directory 'sapase_extracted' is absent + ansible.builtin.file: + path: "{{ __sap_install_media_detect_software_main_directory }}/sapase_extracted/" + state: absent + when: + - not sap_install_media_detect_skip_extraction_if_target_dir_exists + - name: SAP Install Media Detect - SAP ASE - Create Directories ansible.builtin.file: path: "{{ item }}" @@ -13,7 +25,7 @@ - "{{ __sap_install_media_detect_software_main_directory }}/sapase_client_extracted/" - name: SAP Install Media Detect - SAP ASE - List files in directory - ansible.builtin.command: ls -1 + ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" @@ -29,9 +41,10 @@ ignore_errors: true changed_when: false -- name: SAP Install Media Detect - SAP ASE - Identify SAP ASE installation media +# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 +- name: SAP Install Media Detect - SAP ASE - Identify SAP ASE installation media # noqa risky-shell-pipe ansible.builtin.shell: | - set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'BD_SYBASE_ASE' ; then echo '{{ item }}' ; fi ; fi + if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'BD_SYBASE_ASE' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_sapase changed_when: "item | length > 0" with_items: @@ -42,10 +55,10 @@ - name: SAP Install Media Detect - SAP ASE - Identify SAP ASE Client installation media ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}" - recurse: yes + recurse: true file_type: file patterns: '.*ASEBC.*' - use_regex: yes + use_regex: true register: detect_directory_files_sapase_client # Reason for noqa: Difficult to determine the change status in the shell command sequence @@ -55,6 +68,9 @@ - "{{ detect_directory_files_sapase.results | map(attribute='stdout') | select() }}" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" + when: (not __sap_install_media_detect_sapase_extracted_stat.stat.exists) or + ( __sap_install_media_detect_sapase_extracted_stat.stat.exists and not + sap_install_media_detect_skip_extraction_if_target_dir_exists) - name: SAP Install Media Detect - SAP ASE - Extract SAP ASE 16.0 Client with SAPCAR ansible.builtin.shell: | @@ -71,18 +87,19 @@ - name: SAP Install Media Detect - SAP ASE - Identify SAP ASE extracted ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/sapase_extracted" - recurse: yes + recurse: true file_type: directory - patterns: ".*SYBASE_LINUX.*" # Use patterns to identify directory with this string - use_regex: yes + patterns: ".*SYBASE_LINUX.*" + use_regex: true register: detect_directory_sapase_extracted - name: SAP Install Media Detect - SAP ASE - Identify SAP ASE Client extracted ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/sapase_client_extracted" - recurse: yes - file_type: directory - contains: "sybodbc" # Use contains to find specific filename + recurse: true + file_type: file + patterns: ".*sybodbc.*" + use_regex: true register: detect_directory_sapase_client_extracted - name: SAP Install Media Detect - SAP ASE - Local Directory source - move SAP ASE compressed archive files diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml index 1aac91cab..ec70a2190 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml @@ -1,5 +1,17 @@ --- +- name: SAP Install Media Detect - SAP MaxDB - Get info of directory 'sapmaxdb_extracted' + ansible.builtin.stat: + path: "{{ __sap_install_media_detect_software_main_directory }}/sapmaxdb_extracted/" + register: __sap_install_media_detect_sapmaxdb_extracted_stat + +- name: SAP Install Media Detect - SAP MaxDB - Ensure directory 'sapmaxdb_extracted' is absent + ansible.builtin.file: + path: "{{ __sap_install_media_detect_software_main_directory }}/sapmaxdb_extracted/" + state: absent + when: + - not sap_install_media_detect_skip_extraction_if_target_dir_exists + - name: SAP Install Media Detect - SAP MaxDB - Create Directories ansible.builtin.file: path: "{{ item }}" @@ -12,7 +24,7 @@ - "{{ __sap_install_media_detect_software_main_directory }}/sapmaxdb_extracted/" - name: SAP Install Media Detect - SAP MaxDB - List files in directory - ansible.builtin.command: ls -1 + ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" @@ -28,9 +40,10 @@ ignore_errors: true changed_when: false -- name: SAP Install Media Detect - SAP MaxDB - Identify SAP MaxDB installation media +# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 +- name: SAP Install Media Detect - SAP MaxDB - Identify SAP MaxDB installation media # noqa risky-shell-pipe ansible.builtin.shell: | - set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'MaxDB_7.9' ; then echo '{{ item }}' ; fi ; fi + if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'MaxDB_7.9' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_sapmaxdb changed_when: "item | length > 0" with_items: @@ -45,14 +58,17 @@ - "{{ detect_directory_files_sapmaxdb.results | map(attribute='stdout') | select() }}" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" + when: (not __sap_install_media_detect_sapmaxdb_extracted_stat.stat.exists) or + ( __sap_install_media_detect_sapmaxdb_extracted_stat.stat.exists and not + sap_install_media_detect_skip_extraction_if_target_dir_exists) - name: SAP Install Media Detect - SAP MaxDB - Identify SAP MaxDB extracted ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/sapmaxdb_extracted/" - recurse: yes + recurse: true file_type: directory - patterns: '.*MaxDB_7.9.*' # Use patterns to identify directory with this string - use_regex: yes + patterns: '.*MaxDB_7.9.*' + use_regex: true register: detect_directory_sapmaxdb_extracted - name: SAP Install Media Detect - SAP MaxDB - Local Directory source - move SAP MaxDB compressed archive files diff --git a/roles/sap_install_media_detect/tasks/detect_saphana.yml b/roles/sap_install_media_detect/tasks/detect_saphana.yml index 24d5f78d3..0f54d24ad 100644 --- a/roles/sap_install_media_detect/tasks/detect_saphana.yml +++ b/roles/sap_install_media_detect/tasks/detect_saphana.yml @@ -109,15 +109,15 @@ - name: SAP Install Media Detect - SAP HANA - Find SAP_HANA_DATABASE ansible.builtin.find: paths: "{{ sap_hana_install_directory }}" - recurse: yes + recurse: true file_type: directory - contains: "SAP_HANA_DATABASE" + patterns: "SAP_HANA_DATABASE" register: sap_hana_database - name: SAP Install Media Detect - SAP HANA - Find SAP_HANA_CLIENT for SAP SWPM ansible.builtin.find: paths: "{{ sap_hana_install_directory }}" - recurse: yes + recurse: true file_type: directory patterns: "SAP_HANA_CLIENT" register: sap_hana_client_path diff --git a/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml b/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml index f7795359b..5b4e097ac 100644 --- a/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml +++ b/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml @@ -46,13 +46,11 @@ name: unar state: present - - name: SAP Install Media Detect - Prepare - EPEL - Set fact for listing the content of a RAR file + - name: SAP Install Media Detect - Prepare - EPEL - Set facts ansible.builtin.set_fact: sap_install_media_detect_rar_list: '/usr/bin/lsar' - - - name: SAP Install Media Detect - Prepare - EPEL - Set fact for extracting a RAR file - ansible.builtin.set_fact: sap_install_media_detect_rar_extract: '/usr/bin/unar' + sap_install_media_detect_rar_extract_argument: ' -o' - name: SAP Install Media Detect - Prepare - Install an unrar package when: sap_install_media_detect_rar_package != 'EPEL' @@ -63,10 +61,8 @@ name: "{{ sap_install_media_detect_rar_package }}" state: present - - name: SAP Install Media Detect - Prepare - unrar - Set fact for listing the content of a RAR file + - name: SAP Install Media Detect - Prepare - unrar - Set facts ansible.builtin.set_fact: sap_install_media_detect_rar_list: '/usr/bin/unrar lb' - - - name: SAP Install Media Detect - Prepare - unrar - Set fact for extracting a RAR file - ansible.builtin.set_fact: sap_install_media_detect_rar_extract: '/usr/bin/unrar x' + sap_install_media_detect_rar_extract_argument: '' diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index 3fcdd37d0..8ccd8fcb6 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -11,15 +11,15 @@ - name: SAP Install Media Detection Completed - set facts for IBM Db2 ansible.builtin.set_fact: - sap_swpm_cd_ibmdb2_path: "{{ detect_directory_ibmdb2_extracted.files[0].path }}" # for sap_swpm Ansible Role # for sap_swpm Ansible Role - sap_swpm_cd_ibmdb2_client_path: "{{ detect_directory_ibmdb2_client_extracted.files[0].path }}" # for sap_swpm Ansible Role # for sap_swpm Ansible Role + sap_swpm_cd_ibmdb2_path: "{{ detect_directory_ibmdb2_extracted.files[0].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_ibmdb2_client_path: "{{ detect_directory_ibmdb2_client_extracted.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true when: - sap_install_media_detect_db == "ibmdb2" - name: SAP Install Media Detection Completed - set facts for Oracle DB ansible.builtin.set_fact: - sap_anydb_install_oracle_extract_path: "{{ detect_directory_oracledb_extracted.files[0].path }}" # for sao_anydb_install_oracle Ansible Role + sap_anydb_install_oracle_extract_path: "{{ detect_directory_oracledb_extracted.files[0].path }}" # for sap_anydb_install_oracle Ansible Role sap_swpm_cd_oracle_path: "{{ detect_directory_oracledb_extracted.files[0].path }}" # for sap_swpm Ansible Role sap_swpm_cd_oracle_client_path: "{{ detect_directory_oracledb_client_extracted.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true @@ -100,3 +100,27 @@ ignore_errors: true when: - sap_install_media_detect_swpm + +- name: SAP Install Media Detection Completed - set fact for displaying all variables + ansible.builtin.set_fact: + __sap_install_media_detect_vars="{{ __sap_install_media_detect_vars | d('') + item + ' = >' + lookup('vars', item, default='') + '<\n' }}" + loop: + - sap_hana_install_software_directory + - sap_hana_install_software_extract_directory + - sap_swpm_cd_rdms_path + - sap_swpm_cd_ibmdb2_path + - sap_swpm_cd_ibmdb2_client_path + - sap_anydb_install_oracle_extract_path + - sap_swpm_cd_oracle_path + - sap_swpm_cd_oracle_client_path + - sap_swpm_cd_sapase_path + - sap_swpm_cd_sapase_client_path + - sap_swpm_cd_sapmaxdb_path + - sap_swpm_cd_export_path + - sap_swpm_cd_export_pt1_path + - sap_swpm_cd_export_pt2_path + - sap_swpm_sapcar_path + +- name: SAP Install Media Detection Completed - Display all variables + ansible.builtin.debug: + msg: "{{ __sap_install_media_detect_vars.split('\n')[:-1] }}" diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index 20202c080..237d67467 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -85,6 +85,7 @@ {%- for dev in av_dev -%} {%- if (fs.disk_size | string + 'GB') in (dev.value.size | regex_replace('(\.\d+\s*)', '')) and dev.key not in assigned_dev + and dev.value.holders | length == 0 and matching_dev | length < (fs.lvm_lv_stripes | d('1') | int) %} {%- set assigned = assigned_dev.append(dev.key) %} @@ -93,16 +94,17 @@ {%- endif %} {%- endfor %} - - {%- set extend = device_map.extend([ - { - 'device': matching_dev | join(','), - 'fstype': fs.filesystem_type | default(sap_storage_setup_local_filesystem_type), - 'mountpoint': fs.mountpoint | default(''), - 'name': fs.name, - 'size': fs.disk_size, - } - ]) %} + {%- if matching_dev | length > 0 -%} + {%- set extend = device_map.extend([ + { + 'device': matching_dev | join(','), + 'fstype': fs.filesystem_type | default(sap_storage_setup_local_filesystem_type), + 'mountpoint': fs.mountpoint | default(''), + 'name': fs.name, + 'size': fs.disk_size, + } + ]) %} + {%- endif %} {%- endif %} {%- endfor %} {{ device_map }} @@ -151,11 +153,16 @@ - map_item.nfs_path is not defined - '"nfs" not in map_item.filesystem_type' - map_item.swap_path is not defined + - filesystem_device_map is defined + - filesystem_device_map | length > 0 - name: SAP Storage Setup - Display local disk setup assignment ansible.builtin.debug: var: volume_map + when: + - volume_map is defined + ################ diff --git a/roles/sap_swpm/defaults/main.yml b/roles/sap_swpm/defaults/main.yml index 1ed9f0143..4434d9f79 100644 --- a/roles/sap_swpm/defaults/main.yml +++ b/roles/sap_swpm/defaults/main.yml @@ -386,3 +386,6 @@ sap_swpm_setup_firewall: 'false' # Update /etc/hosts sap_swpm_update_etchosts: 'false' + +# Display SAP SWPM Unattended Mode output (sapinst stdout) +sap_swpm_display_unattended_output: false diff --git a/roles/sap_swpm/tasks/swpm.yml b/roles/sap_swpm/tasks/swpm.yml index 84d05ca44..67b255a79 100644 --- a/roles/sap_swpm/tasks/swpm.yml +++ b/roles/sap_swpm/tasks/swpm.yml @@ -96,6 +96,7 @@ - name: SAP SWPM - Display the sapinst output ansible.builtin.debug: msg: "{{ __sap_swpm_register_sapinst.stdout_lines }}" + when: sap_swpm_display_unattended_output - name: SAP SWPM - Find last installation location ansible.builtin.command: cat /tmp/sapinst_instdir/.lastInstallationLocation @@ -114,6 +115,29 @@ register: swpm_success_file_contents changed_when: false +- name: SAP SWPM - Find sapcontrol log file/s + ansible.builtin.find: + paths: "{{ swpm_last_install_path.stdout }}" + recurse: false + file_type: file + patterns: '.*sapcontrol.*log' + use_regex: true + register: swpm_output_sapcontrol_files + +- name: SAP SWPM - Get sapcontrol file/s + ansible.builtin.command: awk -v RS='(^|\n)GetInstanceProperties\n' 'END{printf "%s", $0}' {{ item }} + register: swpm_sapcontrol_file_contents + changed_when: false + loop: "{{ swpm_output_sapcontrol_files.files | map(attribute='path') | list | unique }}" + - name: SAP SWPM - Display installation finished from success file ansible.builtin.debug: msg: "{{ swpm_success_file_contents.stdout_lines }}" + +- name: SAP SWPM - Display status from sapcontrol file/s + ansible.builtin.debug: + msg: "{{ ['GetInstanceProperties'] + file_output.stdout_lines }}" + loop: "{{ swpm_sapcontrol_file_contents.results }}" + loop_control: + loop_var: file_output + label: "{{ file_output.item }}"