Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sap_swpm: New improved and simplified version #840

Open
wants to merge 34 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
4386599
sap_swpm: No longer use different execution modes
berndfinger Aug 2, 2024
ba5fe7c
sap_swpm: Improved section markers for inifile
berndfinger Aug 5, 2024
53fc46f
sap_swpm: Reorganize yml files, part 1
berndfinger Aug 5, 2024
4ef0900
sap_swpm: Fix task name
berndfinger Aug 6, 2024
73df286
sap_swpm: Speed up inifile generation if tag is specified
berndfinger Aug 6, 2024
e065e9f
sap_swpm: Integrate the inifile_reuse mode
berndfinger Aug 6, 2024
7eb407d
sap_swpm: Reorganize yml files, part 2
berndfinger Aug 7, 2024
a9323cd
sap_swpm: Improve variable detection
berndfinger Aug 9, 2024
f3b2381
sap_swpm: Fix typo in README.md
berndfinger Aug 12, 2024
18a7446
sap_swpm: Add certain parameter consistency checks
berndfinger Aug 15, 2024
61f1b7d
sap_swpm: Adapt README.md
berndfinger Aug 22, 2024
f7e5ef7
sap_swpm: Explain how to migrate playbooks
berndfinger Aug 22, 2024
16fd86f
sap_swpm: Fix two typos in inifile_params.j2
berndfinger Aug 22, 2024
03f372b
sap_swpm: Add missing single reverse quote
berndfinger Sep 5, 2024
f039b14
sap_swpm: Repeat PR #850 and solve ansible-lint error
berndfinger Sep 5, 2024
8ce28cf
sap_swpm: Further changes to README.md
berndfinger Sep 5, 2024
6f8e23b
Merge branch 'dev' into new-role-sap_swpm_2
berndfinger Sep 5, 2024
a7875d7
sap_swpm: Only mention the `vars:` section for redefining variables
berndfinger Sep 6, 2024
06c1739
sap_swpm: Recognize sap_swpm_templates_install_dictionary
berndfinger Sep 9, 2024
f0b8339
sap_swpm: No longer define sap_swpm_product_catalog_id...
berndfinger Sep 10, 2024
95ef236
sap_swpm: Allow undefined or empty sap_swpm_role_parameters_dict
berndfinger Sep 10, 2024
c012680
sap_swpm: Prioritize sap_swpm_templates_install_dictionary members
berndfinger Sep 19, 2024
a4ba100
sap_swpm: Adapt README.md to new standard
berndfinger Sep 27, 2024
ac4b06f
docs: Update readme and add vars section
marcelmamula Oct 3, 2024
c12fa43
sap_swpm: Use sap_maintain_etc_hosts role; use booleans
berndfinger Oct 21, 2024
54c4ed7
sap_swpm: Add support for HA virtual hostname resolution
berndfinger Oct 28, 2024
b2f7bc4
sap_swpm: remove roles/sap_swpm/requirements.yml
berndfinger Oct 31, 2024
87188fa
sap_swpm: Implement changes requested for virtual IP checks
berndfinger Nov 4, 2024
0034767
sap_swpm: Run the virtual IP checks before the swpm_prepare tasks
berndfinger Nov 4, 2024
3508e01
sap_swpm: Perform additional assertions for the install type
berndfinger Nov 4, 2024
262ca2e
sap_swpm: Do not include the installation type file for default case
berndfinger Nov 5, 2024
37fff99
sap_swpm: Skip comments in /etc/hosts check
berndfinger Nov 6, 2024
c1ec503
sap_swpm: Fix /etc/hosts ip address resolution
berndfinger Nov 6, 2024
f603471
sap_swpm: Improve the fail message for virt hostname resolution
berndfinger Nov 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
304 changes: 120 additions & 184 deletions roles/sap_swpm/README.md

Large diffs are not rendered by default.

25 changes: 15 additions & 10 deletions roles/sap_swpm/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# SWPM Ansible Role variables
########################################

sap_swpm_ansible_role_mode: "default"
# We do not use role modes any more:
# sap_swpm_ansible_role_mode: "default"
# default
# default_templates
# advanced
Expand Down Expand Up @@ -45,30 +46,29 @@ sap_swpm_files_non_sapcar_group: root

########################################
# SWPM Ansible Role variables
# for Inifile Reuse, Advanced, and Defaults/Advanced Templates Mode
# for creating the sapinst inifile
########################################

# Have the role run the sapinst command with an existing inifile or after creating the inifile:
sap_swpm_run_sapinst: true

# Inifile Reuse Mode
sap_swpm_inifile_reuse_source:
sap_swpm_inifile_reuse_destination:

# Advanced Mode
#sap_swpm_inifile_custom_values_dictionary:
#sap_swpm_inifile_parameters_dict:
# archives.downloadBasket: /software/download_basket
# NW_getFQDN.FQDN: poc.cloud
## add.additional.parameters: ''

# Default/Advanced Templates Mode
#sap_swpm_templates_product_input: ""


########################################
# SWPM Ansible Role variables
# for Default Mode
# - List of inifile parameters to generate
########################################

sap_swpm_inifile_list:
sap_swpm_inifile_sections_list:
- swpm_installation_media
- swpm_installation_media_swpm2_hana
# - swpm_installation_media_swpm1
Expand Down Expand Up @@ -139,7 +139,8 @@ sap_swpm_inifile_list:
########################################

# SAP product that will be installed and passed as argument to the sapinst installer, example 'NW_ABAP_OneHost:S4HANA2020.CORE.HDB.ABAP'
sap_swpm_product_catalog_id:
# Needs to be defined in the playbook or inventory or can be determined from an existing inifile.params file.
#sap_swpm_product_catalog_id:

# SAPCAR path and file name, only path is mandatory. The script will automatically get file_name
sap_swpm_sapcar_path:
Expand All @@ -156,7 +157,7 @@ sap_swpm_software_extract_directory: # e.g. /software/sap_swpm_extracted
sap_swpm_software_use_media: 'false'

# Main path that this role will look for .SAR files
sap_swpm_software_path:
#sap_swpm_software_path: /software/sapfiles
## This directory path should include these files:
## - igs*sar
## - igshelper*sar
Expand All @@ -165,6 +166,10 @@ sap_swpm_software_path:
## - IMDB_CLIENT*SAR
## - SAPHOSTAGENT*SAR

# Directory in which a sapinst inifile which is to be used by the role can be stored:
sap_swpm_inifile_directory: '/software/sap_swpm/inifiles'
#sap_swpm_local_inifile_directory: '/tmp/inifiles'

# SWPM1 - paths that this role will look for CD Media software
sap_swpm_cd_export_pt1_path:
sap_swpm_cd_export_pt2_path:
Expand Down
2 changes: 2 additions & 0 deletions roles/sap_swpm/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@

- name: SAP SWPM - run swpm
ansible.builtin.import_tasks: swpm.yml
when: sap_swpm_run_sapinst
tags:
- sap_swpm_install

- name: SAP SWPM - run postinstall task
ansible.builtin.import_tasks: post_install.yml
when: sap_swpm_run_sapinst
176 changes: 155 additions & 21 deletions roles/sap_swpm/tasks/pre_install.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,148 @@
# SPDX-License-Identifier: Apache-2.0
---

- name: SAP SWPM Pre Install - Define 'sap_swpm_inifile_sections_list' from 'sap_swpm_inifile_list' if necessary
ansible.builtin.set_fact:
sap_swpm_inifile_sections_list: "{{ sap_swpm_inifile_list }}"
when:
- sap_swpm_inifile_sections_list is undefined
- sap_swpm_inifile_list is defined
tags: always

- name: SAP SWPM Pre Install - Define 'sap_swpm_inifile_parameters_dict' from 'sap_swpm_inifile_custom_values_dictionary' if necessary
ansible.builtin.set_fact:
sap_swpm_inifile_parameters_dict: "{{ sap_swpm_inifile_custom_values_dictionary }}"
when:
- sap_swpm_inifile_parameters_dict is undefined
- sap_swpm_inifile_custom_values_dictionary is defined
tags: always

# Note: Variable definitions in sap_swpm_templates_install_dictionary will overwrite existing top level definitions.
- name: SAP SWPM Pre Install - Define variables from 'sap_swpm_templates_install_dictionary' if present
when: sap_swpm_templates_install_dictionary is defined
tags: always
block:

- name: SAP SWPM Pre Install - Display 'sap_swpm_templates_product_input'
ansible.builtin.debug:
msg:
- "sap_swpm_templates_product_input: >{{ sap_swpm_templates_product_input }}<"
ignore_errors: true

- name: SAP SWPM Pre Install - Fail if 'sap_swpm_inifile_sections_list' and 'sap_swpm_inifile_list' are both defined in the dict
ansible.builtin.fail:
msg:
- "FAIL: In 'sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]', both"
- "'sap_swpm_inifile_sections_list' and 'sap_swpm_inifile_list' are defined!"
- "Only one of these variables may be defined in 'sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]'."
when:
- sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_sections_list'] is defined
- sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_list'] is defined

- name: SAP SWPM Pre Install - Fail if 'sap_swpm_inifile_parameters_dict' and 'sap_swpm_inifile_custom_values_dictionary' are both defined in the dict
ansible.builtin.fail:
msg:
- "FAIL: In 'sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]', both"
- "'sap_swpm_inifile_parameters_dict', and 'sap_swpm_inifile_custom_values_dictionary', are defined!"
- "Only one of these variables may be defined in 'sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]'."
when:
- sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_parameters_dict'] is defined
- sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_custom_values_dictionary'] is defined

# Unconditionally define sap_swpm_product_catalog_id from low level member.
- name: SAP SWPM Pre Install - Define 'sap_swpm_product_catalog_id' from low level member with the same name
ansible.builtin.set_fact:
# sap_swpm_product_catalog_id: "{{ sap_swpm_product_catalog_id |
# d(sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_product_catalog_id']) }}"
sap_swpm_product_catalog_id: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_product_catalog_id'] }}"
when: sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_product_catalog_id'] is defined

- name: SAP SWPM Pre Install - Display 'sap_swpm_product_catalog_id'
ansible.builtin.debug:
msg: "sap_swpm_product_catalog_id: >{{ sap_swpm_product_catalog_id }}<"

# Unconditionally define sap_swpm_inifile_sections_list from low level member.
- name: SAP SWPM Pre Install - Define 'sap_swpm_inifile_sections_list' from low level member
ansible.builtin.set_fact:
sap_swpm_inifile_sections_list: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_list'] |
d(sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_sections_list']) }}"
when: sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_list'] is defined or
sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_sections_list'] is defined

# Define sap_swpm_role_parameters_dict from low level member.
- name: SAP SWPM Pre Install - Define 'sap_swpm_role_parameters_dict' from low level member
ansible.builtin.set_fact:
sap_swpm_role_parameters_dict: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_dictionary'] |
d(sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_role_parameters_dict']) }}"
when: sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_dictionary'] is defined or
sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_role_parameters_dict'] is defined

- name: SAP SWPM Pre Install - Display 'sap_swpm_role_parameters_dict'
ansible.builtin.debug:
msg: "sap_swpm_role_parameters_dict: >{{ sap_swpm_role_parameters_dict }}<"
when: sap_swpm_role_parameters_dict is defined and sap_swpm_role_parameters_dict
ignore_errors: true

# Define role variables from low level member, looping over 'sap_swpm_role_parameters_dict'.
# Reason for noqa: We are setting variables from the content of a dict, and the variable names are in the dict keys.
- name: SAP SWPM Pre Install - Define role variables from low level member, looping over 'sap_swpm_role_parameters_dict' # noqa var-naming[no-jinja]
ansible.builtin.set_fact:
"{{ line_item.key }}": "{{ line_item.value }}"
loop: "{{ sap_swpm_role_parameters_dict | dict2items if sap_swpm_role_parameters_dict is mapping else [] }}"
loop_control:
loop_var: line_item
when:
- sap_swpm_role_parameters_dict is defined and sap_swpm_role_parameters_dict

- name: SAP SWPM Pre Install - Display all vars and values of 'sap_swpm_role_parameters_dict'
ansible.builtin.debug:
msg: "{{ line_item.key }}: >{{ lookup('vars', line_item.key) }}<"
loop: "{{ sap_swpm_role_parameters_dict | dict2items if sap_swpm_role_parameters_dict is mapping else [] }}"
loop_control:
loop_var: line_item
when: sap_swpm_role_parameters_dict is defined and sap_swpm_role_parameters_dict
ignore_errors: true

# Define sap_swpm_inifile_parameters_dict from low level member, or use top level variable if defined. Low level definition has precedence.
- name: SAP SWPM Pre Install - Define 'sap_swpm_inifile_parameters_dict' from low level member
ansible.builtin.set_fact:
sap_swpm_inifile_parameters_dict: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_custom_values_dictionary'] |
d(sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_parameters_dict']) }}"
when: sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_custom_values_dictionary'] is defined or
sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_parameters_dict'] is defined

# The following task ensures that the two main inifile creation parameters are defined.
# This is necessary when creating the file 'inifile.params'.
- name: SAP SWPM Pre Install - Define the main inifile creation parameters as empty if necessary
ansible.builtin.set_fact:
sap_swpm_inifile_sections_list: "{{ sap_swpm_inifile_sections_list | d([]) }}"
sap_swpm_inifile_parameters_dict: "{{ sap_swpm_inifile_parameters_dict | d({}) }}"
tags: always

################
# Run Preinstallation Steps Based on Run Mode
################

- name: SAP SWPM Pre Install - Run Preinstallation Steps
ansible.builtin.include_tasks: swpm/swpm_pre_install.yml
ansible.builtin.include_tasks: pre_install/swpm_prepare.yml
tags:
- sap_swpm_generate_inifile
- sap_swpm_sapinst_commandline

################
# Set sapinst command
################

- name: SAP SWPM Pre Install - Set sapinst command
vars:
sap_swpm_swpm_command_guiserver: "{{ 'SAPINST_START_GUISERVER=false' if not sap_swpm_swpm_observer_mode else '' }}"
sap_swpm_swpm_command_observer: "{{ 'SAPINST_REMOTE_ACCESS_USER=' + sap_swpm_swpm_remote_access_user + ' SAPINST_REMOTE_ACCESS_USER_IS_TRUSTED=true' if sap_swpm_swpm_observer_mode and sap_swpm_swpm_remote_access_user | d('', true) | length > 0 else '' }}"
ansible.builtin.set_fact:
sap_swpm_swpm_command_inifile: "SAPINST_INPUT_PARAMETERS_URL={{ sap_swpm_tmpdir.path }}/inifile.params"
sap_swpm_swpm_command_product_id: "SAPINST_EXECUTE_PRODUCT_ID={{ sap_swpm_product_catalog_id }}"
# If SWPM is running a normal install Ansible Variable sap_swpm_swpm_command_virtual_hostname is blank
# IF SWPM is running a HA installation, Ansible Variable sap_swpm_swpm_command_virtual_hostname is set and contains "SAPINST_USE_HOSTNAME={{ sap_swpm_virtual_hostname }} IS_HOST_LOCAL_USING_STRING_COMPARE=true"
# If SWPM is running a MP Stack XML installation, Ansible Variable sap_swpm_swpm_command_mp_stack is set and contains "SAPINST_STACK_XML={{ sap_swpm_mp_stack_path }} + '/' (if needed) + {{ sap_swpm_mp_stack_file_name }}"
sap_swpm_swpm_command_extra_args: "SAPINST_SKIP_DIALOGS=true {{ sap_swpm_swpm_command_guiserver }} {{ sap_swpm_swpm_command_observer }} {{ sap_swpm_swpm_command_virtual_hostname }} {{ sap_swpm_swpm_command_mp_stack }}"
tags: sap_swpm_sapinst_commandline

################
# Pre Install Optional Tasks
################

# Firewall

- name: SAP SWPM Pre Install - Firewall Setup
- name: SAP SWPM Pre Install - Setup Firewall
ansible.builtin.include_tasks:
file: pre_install/firewall.yml
apply:
tags: sap_swpm_setup_firewall
when: "sap_swpm_setup_firewall | bool"
when:
- sap_swpm_run_sapinst
- "sap_swpm_setup_firewall | bool"
tags: sap_swpm_setup_firewall

# /etc/hosts
Expand All @@ -49,7 +152,9 @@
file: pre_install/update_etchosts.yml
apply:
tags: sap_swpm_update_etchosts
when: "sap_swpm_update_etchosts | bool"
when:
- sap_swpm_run_sapinst
- "sap_swpm_update_etchosts | bool"
tags: sap_swpm_update_etchosts

################
Expand Down Expand Up @@ -81,3 +186,32 @@
- ' The installation can take up to 3 hours. Run the following command as root'
- ' on {{ ansible_hostname }} to display the installation logs:'
- ' # tail -f $(cat /tmp/sapinst_instdir/.lastInstallationLocation)/sapinst.log'

################
# Set sapinst command
################

- name: SAP SWPM Pre Install - Set the sapinst command parameters
vars:
sap_swpm_swpm_command_guiserver: "{{ 'SAPINST_START_GUISERVER=false' if not sap_swpm_swpm_observer_mode else '' }}"
sap_swpm_swpm_command_observer: "{{ 'SAPINST_REMOTE_ACCESS_USER=' + sap_swpm_swpm_remote_access_user + ' SAPINST_REMOTE_ACCESS_USER_IS_TRUSTED=true' if sap_swpm_swpm_observer_mode and sap_swpm_swpm_remote_access_user | d('', true) | length > 0 else '' }}"
ansible.builtin.set_fact:
sap_swpm_swpm_command_inifile: "SAPINST_INPUT_PARAMETERS_URL={{ sap_swpm_tmpdir.path }}/inifile.params"
sap_swpm_swpm_command_product_id: "SAPINST_EXECUTE_PRODUCT_ID={{ sap_swpm_product_catalog_id }}"
# If SWPM is running a normal install Ansible Variable sap_swpm_swpm_command_virtual_hostname is blank
# IF SWPM is running a HA installation, Ansible Variable sap_swpm_swpm_command_virtual_hostname is set and contains "SAPINST_USE_HOSTNAME={{ sap_swpm_virtual_hostname }} IS_HOST_LOCAL_USING_STRING_COMPARE=true"
# If SWPM is running a MP Stack XML installation, Ansible Variable sap_swpm_swpm_command_mp_stack is set and contains "SAPINST_STACK_XML={{ sap_swpm_mp_stack_path }} + '/' (if needed) + {{ sap_swpm_mp_stack_file_name }}"
sap_swpm_swpm_command_extra_args: "SAPINST_SKIP_DIALOGS=true {{ sap_swpm_swpm_command_guiserver }} {{ sap_swpm_swpm_command_observer }} {{ sap_swpm_swpm_command_virtual_hostname }} {{ sap_swpm_swpm_command_mp_stack }}"
tags: sap_swpm_sapinst_commandline

- name: Set fact for the sapinst command line
ansible.builtin.set_fact:
__sap_swpm_sapinst_command: "umask {{ sap_swpm_umask | d('022') }} ; ./sapinst {{ sap_swpm_swpm_command_inifile }}
{{ sap_swpm_swpm_command_product_id }}
{{ sap_swpm_swpm_command_extra_args }}"
tags: sap_swpm_sapinst_commandline

- name: Display the sapinst command line
ansible.builtin.debug:
msg: "SAP SWPM install command: '{{ __sap_swpm_sapinst_command }}'"
tags: sap_swpm_sapinst_commandline
80 changes: 80 additions & 0 deletions roles/sap_swpm/tasks/pre_install/detect_variables_from_inifile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# SPDX-License-Identifier: Apache-2.0
---

# Detect and set Product ID
- name: SAP SWPM Pre Install - Detect Product ID from inifile
ansible.builtin.command: |
awk 'BEGIN{IGNORECASE=1;a=0}
/Product ID/&&a==0{a=1; gsub ("#", ""); gsub ("\047", ""); product_id=$NF}
END{print product_id}' {{ sap_swpm_tmpdir_local.path }}/inifile.params
delegate_to: localhost
register: sap_swpm_inifile_product_id_detect
changed_when: false

- name: SAP SWPM Pre Install - Report if 'sap_swpm_product_catalog_id' has been defined differently
ansible.builtin.debug:
msg: "NOTE: The Product ID in '{{ sap_swpm_tmpdir_local.path }}/inifile.params' is different from the role parameter 'sap_swpm_inifile_product_id_detect'."
when:
- sap_swpm_product_catalog_id
- sap_swpm_inifile_product_id_detect.stdout != sap_swpm_product_catalog_id

- name: SAP SWPM Pre Install - Set SAP product ID
ansible.builtin.set_fact:
sap_swpm_product_catalog_id: "{{ sap_swpm_inifile_product_id_detect.stdout }}"

# Detect and set Software Path
- name: SAP SWPM Pre Install - Detect Software Path from inifile
ansible.builtin.command: |
awk '!/^#/&&/archives.downloadBasket/{print $3}' {{ sap_swpm_tmpdir_local.path }}/inifile.params
delegate_to: localhost
register: sap_swpm_inifile_software_path_detect
changed_when: false

- name: SAP SWPM Pre Install - Report if 'sap_swpm_software_path' has been defined differently
ansible.builtin.debug:
msg: "NOTE: The Software Path in '{{ sap_swpm_tmpdir_local.path }}/inifile.params' is different from the role parameter 'sap_swpm_software_path'."
when:
- sap_swpm_software_path
- sap_swpm_inifile_software_path_detect.stdout != sap_swpm_software_path

- name: SAP SWPM Pre Install - Set Software Path
ansible.builtin.set_fact:
sap_swpm_software_path: "{{ sap_swpm_inifile_software_path_detect.stdout }}"

# Detect and set SID
- name: SAP SWPM Pre Install - Detect SID from inifile
ansible.builtin.command: |
awk '!/^#/&&/NW_GetSidNoProfiles.sid/{print $3}' {{ sap_swpm_tmpdir_local.path }}/inifile.params
delegate_to: localhost
register: sap_swpm_inifile_sid_detect
changed_when: false

- name: SAP SWPM Pre Install - Report if 'sap_swpm_sid' has been defined differently
ansible.builtin.debug:
msg: "NOTE: The SID in '{{ sap_swpm_tmpdir_local.path }}/inifile.params' is different from the role parameter 'sap_swpm_sid'."
when:
- sap_swpm_sid
- sap_swpm_inifile_sid_detect.stdout != sap_swpm_sid

- name: SAP SWPM Pre Install - Set SID
ansible.builtin.set_fact:
sap_swpm_sid: "{{ sap_swpm_inifile_sid_detect.stdout }}"

# Detect and set FQDN
- name: SAP SWPM Pre Install - Detect FQDN from inifile
ansible.builtin.command: |
awk '!/^#/&&/NW_getFQDN.FQDN/{print $3}' {{ sap_swpm_tmpdir_local.path }}/inifile.params
delegate_to: localhost
register: sap_swpm_inifile_fqdn_detect
changed_when: false

- name: SAP SWPM Pre Install - Report if 'sap_swpm_fqdn' has been defined differently
ansible.builtin.debug:
msg: "NOTE: The FQDN in '{{ sap_swpm_tmpdir_local.path }}/inifile.params' is different from the role parameter 'sap_swpm_fqdn'."
when:
- sap_swpm_fqdn
- sap_swpm_inifile_sid_detect.stdout != sap_swpm_fqdn

- name: SAP SWPM Pre Install - Set FQDN
ansible.builtin.set_fact:
sap_swpm_fqdn: "{{ sap_swpm_inifile_fqdn_detect.stdout }}"
Loading
Loading