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

Conversation

berndfinger
Copy link
Member

@berndfinger berndfinger commented Aug 22, 2024

I am providing an improved and simplified version of the role sap_swpm, with the following features:

  • No longer use separate role modes while keeping the same functionality.
  • Enable creating the sapinst input file inifile.params using both methods (inifile sections and direct parameter setttings), similar to combining the default and advanced modes of the previous version. In the first step (but only if the role parameter sap_swpm_inifile_sections_list is defined), the new sap_swpm version is creating the file inifile.params from the inifile sections in the template. Then, if the parameter sap_swpm_inifile_parameters_dict is defined, existing variable definitions can be modified, or additional variables and their settings can be added at the end of the file. This provides maximum flexibility for creating the file inifile.params while not increasing the complexity of the logic.
  • No longer use the 3 or 4 level dictionary sap_swpm_inifile_custom_values_dictionary (for setting role variables) inside the role, as it was required for the previous modes default_templates and advanced_templates. The dictionary can still be used and maintained, by setting certain top level role parameters from dictionary members. Note: You cannot access low level dictionary members using a variable which has been defined in the same task. For defining mid-level variables of a dictionary, you have to use a separate task (e.g. set_fact) before.
  • Enable creating a sapinst inifile.params parameter input file within a few seconds (using tag sap_swpm_generate_inifile), without running pre_install steps. This file can then be transferred to managed nodes, to be re-used later, even by the role sap_swpm for running unattended installations.
  • Similar to the role sap_hana_install (parameter sap_hana_install_configfile_directory), the new version of sap_swpm is now checking for an existing installer input file on the managed node (parameter sap_swpm_inifile_directory), not on the control node.

@berndfinger
Copy link
Member Author

Note: I successfully tested with ap4s scenarios sap_s4hana_sandbox and sap_s4hana_standard on AWS. Testing with sap_s4hana_distributed_ha is still ongoing.

@berndfinger berndfinger changed the title A new simplified version of sap_swpm sap_swpm: New improved and simplified version Aug 22, 2024
Copy link
Contributor

@marcelmamula marcelmamula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small changes needed, while I continue testing.

roles/sap_swpm/README.md Outdated Show resolved Hide resolved
roles/sap_swpm/README.md Outdated Show resolved Hide resolved
roles/sap_swpm/tasks/pre_install.yml Outdated Show resolved Hide resolved
berndfinger and others added 9 commits September 5, 2024 10:07
... for better readability

Signed-off-by: Bernd Finger <[email protected]>
... in defaults/main.yml

Signed-off-by: Bernd Finger <[email protected]>
Due to the use of global variables in sap_swpm, there appears to be no
simple way of giving priority to top level vars over the same variables
defined in sap_swpm_templates_install_dictionary.
We can also assume that if using sap_swpm_templates_install_dictionary,
this is done on purpose and with the intention to use its members with
priority over top level variables.

Signed-off-by: Bernd Finger <[email protected]>
@berndfinger
Copy link
Member Author

Successfully tested with AP4S scenarios:

  • sap_s4hana_distributed_ha
  • sap_s4hana_distributed
  • sap_hana_scaleout
  • sap_hana_ha and
  • sap_hana

on AWS, using the dictionary sap_swpm_templates_install_dictionary and SAP S/4HANA Foundation 2023.

Note: Variables defined inside the dictionary sap_swpm_templates_install_dictionary have precedence over the variables with the same name defined on the top level (=with global scope), if any. Example:

sap_hana_install_media_dictionary:
  sap_s4hana_2023_distributed_nwas_ascs:
    sap_swpm_product_catalog_id: NW_ABAP_ASCS:S4HANA2023.FNDN.HDB.ABAP
    sap_swpm_inifile_list:
      - swpm_installation_media
      - swpm_installation_media_swpm2_hana
      - credentials
    sap_swpm_inifile_dictionary:
      sap_swpm_install_saphostagent: 'true'

If the variable sap_swpm_install_saphostagent is defined to false separately (e.g. by set_fact in another play of the same playbook), such a definition will be ignored and the value of true will be taken from sap_swpm_install_saphostagent defined inside sap_swpm_templates_install_dictionary. The same applies to sap_swpm_product_catalog_id and to sap_swpm_inifile_list.

The role is using set_fact to set such variables on the top level (=with global scope), so be sure to set these variables to the desired value (e.g. in the vars: section) when calling the role again in the same playbook (even if it's in a different play).

Note: This is WIP.

Signed-off-by: Bernd Finger <[email protected]>
Copy link
Contributor

@marcelmamula marcelmamula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional changes that would be good to include:

  1. remove /etc/hosts steps and replace them with /etc/hosts role instead.
  2. Correct non-standard variable inputs like sap_swpm_use_password_file == "y"

I found them while updating Readme.

@marcelmamula marcelmamula added documentation Improvements or additions to documentation enhancement New feature or request labels Oct 3, 2024
Copy link
Member

@rhmk rhmk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

This file should only exist on the collection level.

Signed-off-by: Bernd Finger <[email protected]>
Also modify the fail_msg to not resolve sap_swpm_virtual_hostname

Signed-off-by: Bernd Finger <[email protected]>
Copy link
Contributor

@marcelmamula marcelmamula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thank you @berndfinger for patiently testing and fixing all issues with me to hopefully resolve all issues before merging.

@ja9fuchs
Copy link
Contributor

ja9fuchs commented Nov 7, 2024

Successfully tested an ASCS/ERS installation. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants