community.sap_install icon indicating copy to clipboard operation
community.sap_install copied to clipboard

sap_swpm: Using different TEMP dir fails playbook

Open slubb opened this issue 2 years ago • 8 comments

I'm installing SAP using a different TEMP directory:

- name: Play install SAP Web Dispatcher
  hosts: hosts
  gather_facts: True
  become: true
  environment:
    TEMP: /usr/sap/tmp

Installation works as expected however there are 2 issues:

  1. The summary pre start: It now shows the wrong path.
TASK [community.sap_install.sap_swpm : SAP SWPM - Installation Process] ******************************************************
ok: [xxhost] => {
    "msg": [
        "   Ready to run SWPM for SAP Software Installation  ",
        " ",
        "   SAP Product        -       NW_Webdispatcher:NW750.IND.PD  ",
        "   SID                -       WAD ",
        "   Host               -       xxhost",
        " ",
        "   The installation can take up to 3 hours. Run the following command as root",
        "   on xxhost to display the installation logs:",
        "   # tail -f $(cat /tmp/sapinst_instdir/.lastInstallationLocation)/sapinst.log"
    ]
}

  1. This step now fails because it doesn't look at the correct tmp dir.
TASK [community.sap_install.sap_swpm : SAP SWPM - Find last installation location] *******************************************
fatal: [xxhost]: FAILED! => 
{
    "changed": false,
    "cmd": [
        "cat",
        "/tmp/sapinst_instdir/.lastInstallationLocation"
    ],
    "delta": "0:00:00.008100",
    "end": "2023-03-17 12:14:35.335597",
    "msg": "non-zero return code",
    "rc": 1,
    "start": "2023-03-17 12:14:35.327497",
    "stderr": "cat: /tmp/sapinst_instdir/.lastInstallationLocation: No such file or directory",
    "stderr_lines": [
        "cat: /tmp/sapinst_instdir/.lastInstallationLocation: No such file or directory"
    ],
    "stdout": "",
    "stdout_lines": []
}

slubb avatar Mar 22 '23 13:03 slubb

Hi @slubb , the error occurs because these Ansible Tasks statically use /tmp.

Can you provide justification why you want to change the Temporary Directory for the installation, and why /usr/sap/tmp (which should really be reserved <sid>adm processes)?

I am unsure whether adding a variable to switch the Temporary Directory is a good idea. I would need convincing.

sean-freeman avatar Mar 23 '23 15:03 sean-freeman

I have a customer and the have mounted their /tmp on noexec. This fails the default installation. If I change the TEMP it goes fine except for the hardcoded parts. I've started internal investigations why this is mounted like that, but it's still silent from that part. Don't know if the noexec part is convincing enough ;-) ?

slubb avatar Mar 27 '23 19:03 slubb

@slubb looks like there is no guidance from SAP on this topic, all we have is SAP Note 2063079 - "Child has signaled an exec error (-138)" and "Permission Denied" - Error to extract SWPM

Will ask someone from Red Hat or SUSE to comment. If I recall correctly, /tmp is frequently set by default as noexec when installing from ISO of either OS.

sean-freeman avatar Mar 28 '23 20:03 sean-freeman

Same issue here. VM hardening mandate noexec on temp folders. What about a pre and post task to change them while the install is in flight?

wuftymerguftyguff avatar Oct 05 '23 15:10 wuftymerguftyguff

@wuftymerguftyguff That would probably be considered a security vulnerability to make that alteration as part of the code. This GH Issue still needs comment from SUSE or Red Hat.

sean-freeman avatar Oct 05 '23 16:10 sean-freeman

In that case I think that the static use of /tmp needs to be removed to allow the adoption of the guidance in 2063079

wuftymerguftyguff avatar Oct 05 '23 16:10 wuftymerguftyguff

Solution might be to use variable ansible_env (collected as part of ansible facts) instead of hard coding '/tmp'. As per SAP documentation $TEMP is used to place sapinst_instdir, not /tmp

https://help.sap.com/docs/SLTOOLSET/06f7611290ea4b8d9bc431a8d7bf05c3/84e70c5206893c3ae10000000a441470.html?version=CURRENT_VERSION_SWPM20

So this is indeed an issue - because role does not support standard SAP functionality.

kksat avatar Oct 05 '23 16:10 kksat

@berndfinger is this still open issue?

kksat avatar Jan 19 '24 16:01 kksat