sap-linuxlab / community.sap_install

Automation for SAP - Collection of Ansible Roles for various SAP software installation
Apache License 2.0
53 stars 56 forks source link

sap_swpm: S4HANA Single Host installation FAILS #298

Closed picoroma closed 1 year ago

picoroma commented 1 year ago

I'm trying to perform a S4HANA 2020 Installation I'm using the default template (sample-sap-swpm-default-mode.yml where i set\changes some vars (software path mostly) accordingly to my scenario.

The running command is something like that:

ansible-playbook sap-swpm-default-mode.yml \
-l saphana1 \
-e @/home/ubuntu/playbook/sap_hana/vars/variables-sap-swpm-default-mode-s4hana-install.yml

The Installation works fine until the pre-install phase. When start the ./sapinst process I have an error. Seems related to the master password that is not recognized into the vars file:

 "ERROR      2022-12-21 16:28:58.997 (root/sapinst) (startInstallation) [CSiStepExecute.cpp:1104] id=controller.stepExecuted errno=FCO-00011 CSiStepExecute::execute()",
        "The step askMasterPwd with step key |NW_ABAP_OneHost|ind|ind|ind|ind|0|0|NW_Onehost_System|ind|ind|ind|ind|onehost|0|NW_GetSidNoProfiles|ind|ind|ind|ind|getSid|0|NW_GetUserParameter|ind|ind|ind|ind|users|0|NW_GetMasterPassword|ind|ind|ind|ind|masterpwd|0|askMasterPwd was executed with status ERROR (Last error reported by the step: Caught ESAPinstException in module call: Validator of step '|NW_ABAP_OneHost|ind|ind|ind|ind|0|0|NW_Onehost_System|ind|ind|ind|ind|onehost|0|NW_GetSidNoProfiles|ind|ind|ind|ind|getSid|0|NW_GetUserParameter|ind|ind|ind|ind|users|0|NW_GetMasterPassword|ind|ind|ind|ind|masterpwd|0|askMasterPwd' reported an error:",
        "Start SAPinst in interactive mode to solve this problem).",

See attached file for more details. sap_swpm_error.txt

picoroma commented 1 year ago

Additional info: ERROR FCO-00011 -->https://me.sap.com/notes/0001949033 Problem with running ./sapinst with sudo (./sapinst should be run as root)

berndfinger commented 1 year ago

It might be that the sapinst should be run as root message is just a follow-up error of the error in step askMasterPwd. I suggest to check the following:

I also suggest that you use the latest version of the collection (if not done already), now available as version 1.2.0 on Galaxy. Or, if you are using the collection directly from GitHub, get the latest bits - now also in the main tree.

The sap_swpm role now can be run with tags, for example to just create the inifile. You can then inspect the inifile and execute the sapinst command manually, or re-run the role after modifying the role variables to get the desired inifile contents.

picoroma commented 1 year ago

My vars file looks like this (from template):

# Product ID for New Installation
sap_swpm_product_catalog_id: NW_ABAP_OneHost:S4HANA2020.CORE.HDB.ABAP

# Software
sap_swpm_software_path: /software/S4HANA-2020_INST/kernel
sap_swpm_sapcar_path: /software/S4HANA-2020_INST/SAPCAR
sap_swpm_swpm_path: /software/S4HANA-2020_INST/SWPM

# NW Passwords
sap_swpm_master_password: "MYPSWD"
sap_swpm_ddic_000_password: "MYPSWD"

# HDB Passwords
sap_swpm_db_system_password: "MYPSWD"
sap_swpm_db_systemdb_password: "MYPSWD"
sap_swpm_db_schema_abap: "SAPHANADB"
sap_swpm_db_schema_abap_password: "MYPSWD"
sap_swpm_db_sidadm_password: "MYPSWD"

# NW Instance Parameters
sap_swpm_sid: S4H
sap_swpm_pas_instance_nr: "01"
sap_swpm_ascs_instance_nr: "02"
sap_swpm_ascs_instance_hostname: "{{ ansible_hostname }}"
sap_swpm_fqdn: "poc.cloud"

# HDB Instance Parameters
# For dual host installation, change the db_host to appropriate value
sap_swpm_db_host: "{{ ansible_hostname }}"
sap_swpm_db_sid: HDB
sap_swpm_db_instance_nr: "00"

-- inifile.params attached. P. inifile.params.txt

I have also another question. The EXPORT file necessary for every SAP S/4HANA Installation where should be placed ? In the documentation there is no mention to these files !

sean-freeman commented 1 year ago

At very quick glance, password does not appear to meet complexity requirements and results in error. SAP SWPM error messages are not very clear when using SAP SWPM Unattended Mode.

For the other question, please follow GH etiquette and raise another GH Issue for an error or GH Discussion for was code logic questions.

picoroma commented 1 year ago

I have tryed even with a more long password "Abcdefgh01" (9 char + 2 number) but the error remain the same

sean-freeman commented 1 year ago

If I recall, a special character is required. I use NewPass$321 when calling this Ansible Collection as part of the Terraform Templates for SAP. You can see the Ansible Playbook and extravars file which is used, in this directory - https://github.com/sap-linuxlab/terraform.modules_for_sap/tree/main/all/ansible_sap_s4hana_install

When I am back from vacation I will be able to investigate further, it the above password does not work

picoroma commented 1 year ago

Even adding a special char (!) to my pswd I still have error. OK. I will wait for your feedback. THX for now

rhmk commented 1 year ago

The installation is indeed picky about the password, but when I used this role. I remember that I got strange errors, that were caused by a scrambled /etc/hosts file. This is a known issue and we are working on this.

Can you try setting the password Sean's suggestion make sure your /etc/hosts is configured correctly (with the hana-Db and the app server and that this matches your DNS setting) or your DNS is configured for proper resolution prior to running the role. Then please add sap_swpm_update_etchosts: false to your parameters and try again.

I know it doesn't sound related, but that causes the installer to fail with the password, because it resolves to a wrong host.

berndfinger commented 1 year ago

FYI - The installation of NW_ABAP_OneHost:S4HANA2022.FNDN.HDB.ABAP succeeds when using:

sap_swpm_master_password: "Abcdefgh01"
sap_swpm_ddic_000_password: "Abcdefgh01"
sap_swpm_db_system_password: "Abcdefgh01"
sap_swpm_db_systemdb_password: "Abcdefgh01"
sap_swpm_db_schema_abap_password: "Abcdefgh01"
sap_swpm_db_sidadm_password: "Abcdefgh01"

So at least for this version, the password is not the problem.

picoroma commented 1 year ago

The installation is indeed picky about the password, but when I used this role. I remember that I got strange errors, that were caused by a scrambled /etc/hosts file. This is a known issue and we are working on this.

Can you try setting the password Sean's suggestion make sure your /etc/hosts is configured correctly (with the hana-Db and the app server and that this matches your DNS setting) or your DNS is configured for proper resolution prior to running the role. Then please add sap_swpm_update_etchosts: false to your parameters and try again.

I know it doesn't sound related, but that causes the installer to fail with the password, because it resolves to a wrong host.

My /etc/hosts looks like this:

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

# host entries by LaunchWizard

172.30.2.32     saphana1.poc.cloud      saphana1

I think is correct. Don't you?

rhmk commented 1 year ago

This looks ok, from the SWPM role perspective, but the s4hana server should be in there as well. Did you run sap_general_preconfigure and sap_netweaver_preconfigure roles before running sap_swpm?

picoroma commented 1 year ago

Installation finished with no error. THX

picoroma commented 1 year ago

One question. Due to fact that I'm testing and try to install several time. Is there a way to UNINSTALL the S/4HANA using the role swpm ? If yes - HOW?

berndfinger commented 1 year ago

Can you please let us know by (or after) which action you were able to finish the installation?

Note that for a system on which both NetWeaver and HANA are running, the tuned profile sap-hana needs to be activated, so the order of the preconfigure roles should be:

  1. sap_general_preconfigure
  2. sap_netweaver_preconfigure
  3. sap_hana_preconfigure

For uninstalling the S/4HANA NetWeaver components, it should be possible to re-use an inifile from an interactive sapinst session where you chose the uninstall option and then use this inifile in the role sap_swpm. For uninstalling the SAP HANA database , I am always using a playbook which contains mainly the following task:

    - name: "Force uninstall SAP HANA '{{ sap_hana_install_sid }}'" # noqa command-instead-of-shell # noqa no-changed-when
      ansible.builtin.command: "{{ sap_hana_install_install_path }}/{{ sap_hana_install_sid }}/hdblcm/hdblcm --uninstall --components=all -b"
      register: command_output

P.S. Please consider using uppercase only where necessary (see also this Wikipedia page). For emphasizing words, you could use the bold formatting option in the GUI, for example.

sean-freeman commented 1 year ago

I've never had issue with /etc/hosts causing unusual errors with SAP SWPM other than an immediate crash (when SAP SWPM cannot start it's web host engine), and such errors are very infrastructure environment specific (admins usually alter this file in OS Images) and difficult to diagnose. Particularly given this is a OneHost sample and the provided hosts file above, it is unlikely to be the error source.

The sample files are Role-specific, and take the literal meaning of the word "sample". They will work but they are meant to be used together with other Roles (in a logical sequence, e.g. don't install before you have the install media 😄). See below a test execution I did with a full Ansible Playbook for SAP installation file. It would be good to understand what you had issue with, in case the sample files need a fix or documentation needs to be clearer.

As Bernd highlights, any SAP SWPM activity can work with the sap_swpm Ansible Role. Uninstallation is not something that a sample should be provided for, in case of accidents by new users 🙂 Again, such a query belongs in a new GH Issue.

TL;DR - please provide what fixed your execution of sap_swpm, review example below, and close the GH Issue if you are happy to do so


Ansible Playbook for SAP installation file execution of SAP S/4HANA OneHost using sap_swpm Ansible Role with 'Default mode'

---

- name: Ansible Playbook execution for SAP S/4HANA installation from source media
  hosts: all
  become: true

# Use include_role inside Task block, instead of using roles declaration or Task block with import_roles.
# This ensures Ansible Roles, and the tasks within, will be parsed in sequence instead of parsing at Playbook initialisation
  tasks:

    - name: Update etc hosts
      lineinfile:
        dest: /etc/hosts
        line: "{{ ansible_default_ipv4.address }}\t{{ ansible_hostname }}.{{ ansible_domain }}\t{{ ansible_hostname }}"
        state: present
      become: yes

#    - name: Execute Ansible Role sap_install_media_detect
#      include_role:
#        name: { role: community.sap_install.sap_install_media_detect }

    - name: Execute Ansible Role sap_general_preconfigure
      include_role:
        name: { role: community.sap_install.sap_general_preconfigure }

    - name: Execute Ansible Role sap_netweaver_preconfigure 
      include_role:
        name: { role: community.sap_install.sap_netweaver_preconfigure }

    - name: Execute Ansible Role sap_hana_preconfigure 
      include_role:
        name: { role: community.sap_install.sap_hana_preconfigure }

    - name: Execute Ansible Role sap_hana_install 
      include_role:
        name: { role: community.sap_install.sap_hana_install }

    - name: Execute Ansible Role sap_swpm with SAP S/4HANA One Host installation from source media
      include_role:
        name: { role: community.sap_install.sap_swpm }

  vars:

    # ---- Mandatory parameters : Ansible Defaults ---- #

    # Default Ansible Facts populate into default variables for all Ansible Roles
    sap_hostname: "{{ ansible_hostname }}"
    sap_domain: "{{ ansible_domain }}"
    sap_ip: "{{ ansible_default_ipv4.address }}"

    # ---- Mandatory parameters : Preconfigure OS for SAP Software ---- #

    # Configuration of Ansible Roles for preconfigure SAP (general, hana, netweaver)
    sap_general_preconfigure_modify_etc_hosts: false
    sap_general_preconfigure_reboot_ok: no
    sap_general_preconfigure_fail_if_reboot_required: no
    sap_hana_preconfigure_reboot_ok: yes
    sap_hana_preconfigure_fail_if_reboot_required: no
    sap_hana_preconfigure_update: yes
    sap_hana_update_etchosts: yes
    sap_netweaver_preconfigure_fail_if_not_enough_swap_space_configured: no

    # ------ Mandatory parameters : SAP HANA installation ------ #

    # Install directory of SAP HANA must contain:
    #   1.  IMDB_SERVER*SAR file
    #   2.  IMDB_*SAR files for all SAP HANA components to install
    #   3.  SAPCAR executable
    sap_hana_install_software_directory: "/software/sap_hana"

    # SAP HANA master password
    sap_hana_install_use_master_password: "y"
    sap_hana_install_master_password: "NewPass$321"

    # SAP HANA database server instance details
    sap_hana_install_sid: "H01"
    sap_hana_install_instance_number: "10"

    # ------ Optional parameters : SAP HANA installation ------ #

    # Update hosts file
    sap_hana_install_update_etchosts: 'false'

    # ------ Mandatory parameters : SAP SWPM installation using Default mode of the Ansible Role ------ #

    # sap_swpm Ansible Role mode
    sap_swpm_ansible_role_mode: default

    # sap_swpm Default mode generate inifile.params
    sap_swpm_inifile_list:
      - swpm_installation_media
      - swpm_installation_media_swpm2_hana
      - credentials
      - credentials_hana
      - db_config_hana
      - db_connection_nw_hana
      - nw_config_other
      - nw_config_central_services_abap
      - nw_config_primary_application_server_instance
      - nw_config_ports
      - sap_os_linux_user

    # Product ID for New Installation
    sap_swpm_product_catalog_id: NW_ABAP_OneHost:S4HANA2022.CORE.HDB.ABAP

    # Software
    sap_swpm_sapcar_path: /software
    sap_swpm_swpm_path: /software
    sap_swpm_software_path: /software

    # NW Passwords
    sap_swpm_master_password: "NewPass$321"
    sap_swpm_ddic_000_password: "NewPass$321"

    # HDB Passwords
    sap_swpm_db_system_password: "NewPass$321"
    sap_swpm_db_systemdb_password: "NewPass$321"
    sap_swpm_db_schema_abap_password: "NewPass$321"
    sap_swpm_db_sidadm_password: "NewPass$321"

    # NW Instance Parameters
    sap_swpm_sid: "S01"
    sap_swpm_pas_instance_nr: "00"
    sap_swpm_ascs_instance_nr: "01"
    sap_swpm_ascs_instance_hostname: "{{ ansible_hostname }}"
    sap_swpm_fqdn: "poc.cloud"

    # HDB Instance Parameters
    # For dual host installation, change the db_host to appropriate value
    sap_swpm_db_host: "s4h01"
    sap_swpm_db_sid: "H01"
    sap_swpm_db_instance_nr: "10"
    sap_swpm_db_schema_abap: "SAPHANADB"
    sap_swpm_update_etchosts: 'false'
arubasu commented 1 year ago

One question. Due to fact that I'm testing and try to install several time. Is there a way to UNINSTALL the S/4HANA using the role swpm ? If yes - HOW?

How come you fix the issue? I am still getting the error.

my /etc/hosts looks like,

[root@vm-techsapapp ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.0.1.7 vm-techsapapp.poc.cloud vm-techsapapp
10.0.1.6 vm-techsapdb.poc.cloud vm-techsapdb
[root@vm-techsapapp ~]# 
sean-freeman commented 1 year ago

@arubasu By default the samples are One Host, you have Dual Host (aka. Three Tier) configured in your /etc/hosts.

Please ensure you do not have this line:

sap_swpm_db_host: "{{ ansible_hostname }}"

Instead replace with:

sap_swpm_db_host: "dbhostname.subdomainifexist.rootdomain.tld"

If error not resolved, please raise separate GH Issue and provide your variables and error messages accordingly.

arubasu commented 1 year ago

@sean-freeman I have raised a new GH Issue. https://github.com/sap-linuxlab/community.sap_install/issues/301

sean-freeman commented 1 year ago

@picoroma if this GH Issue is not responded to within 7 days, I will close / mark it as resolved

sean-freeman commented 1 year ago

@picoroma I am closing this GH Issue due to lack of response, I hope the explanations solved your error with SAP SWPM