Code Monkey home page Code Monkey logo

sapnwbootstrap-formula's Introduction

SAP Netweaver Salt formula

Salt formula to bootstrap and manage SAP Netweaver platforms.

Features

Currently the next SAP Netweaver components are available:

  • ASCS instance
  • ERS instance
  • PAS instance
  • AAS instance
  • Database instance (this adds the required users, tables, views, etc to the current Hana database)

Besides that, the formula setups all of the pre requirements as:

  • Hostnames
  • Virtual addresses
  • NFS mounts
  • Shared disks
  • SWAP partition space

The formula follows the best practices defined in the official SUSE documentation.

Disclaimer: the formula only works with SAP Hana as database.

Installation

The project can be installed in many ways, including but not limited to:

  1. RPM
  2. Manual clone

RPM

On openSUSE or SUSE Linux Enterprise you can just use the zypper system package manager:

zypper install sapnwbootstrap-formula

Important! This will install the formula in /usr/share/salt-formulas/states/netweaver. In case the formula is used in a masterless mode, make sure that the /usr/share/salt-formulas/states entry is correctly configured in the file_roots entry of the Salt minion configuration.

Depending on the patch level of the target system and the release cycle of this project, the package in the regular repository might not be the latest one. If you want the latest features, have a look in the test development repositories at SUSE's Open Build Service network:ha-clustering:sap-deployments:devel/sapnwbootstrap-formula.

Manual Installation

A manual installation can be done by cloning this repository:

git clone https://github.com/SUSE/sapnwbootstrap-formula

Important! This will not install the the formula anywhere where salt can find it. If the formula is used in a masterless mode, also make sure to copy the complete netweaver subdirectory to location defined in file_roots entry of your Salt minion configuration.

I. e.:

cd sapnwbootstrap-formula
cp -R netweaver /srv/salt

Important! The formulas depends on salt-shaptools package. Make sure it is installed properly if you follow the manual installation (the package can be installed as a RPM package too).

Usage

Pre-requirements

The formula has some hard dependencies and all of them must be in place for a successful netweaver deployment.

  • In order to deploy a correct Netweaver environment a NFS share is needed (SAP stores some shared files there). The NFS share must have the folders sapmnt and usrsapsys in the exposed folder. It's a good practice the create this folder with the Netweaver SID name (for example /sapdata/HA1/sapmnt and /sapdata/HA1/usrsapsys). This subfolders content is removed by default during the deployment.

  • Netweaver installation software (swpm) must be available in the system. To install the whole Netweaver environment with all the 4 components, the swpm folder, sapexe folder, Netweaver Export folder and HANA HDB Client folders must already exist, or be previously mounted when provided by external service, like NFS share. The netweaver.sls pillar file must be updated with all this information. Netweaver Export and HANA HDB Client folders must go in additional_dvds list. Check the pillar.example for more details.

  • The optimal deployment requires 4 machines in the same network for each of the Netweaver instances (the DB instance can be installed anywhere after ASCS and ERS are installed).

  • SAP Hana database must be up and running.

Find an example about all of the possible configurable options in the pillar.example file.

Configuration

Follow the next steps to configure the formula execution. After this, the formula can be executed using master/minion or masterless options. For further informations, please have a look to the Salt documentation.

  1. Modify the top.sls file (by default stored in /srv/salt) including the netweaver entry.

    Here is an example to execute the Netweaver formula in all of the nodes:

    # This file is /srv/salt/top.sls
    base:
      '*':
        - netweaver
    
  2. Customize the execution pillar file. Here an example of a pillar file for this formula with all of the options: pillar.example The pillar.example can be found either as a link to the file in the master branch or a file in the file system at /usr/share/salt-formulas/metadata/hana/pillar.example.

  3. Set the execution pillar file. For that, modify the top.sls of the pillars (by default stored in /srv/pillar) including the netweaver entry and copy your specific netweaver.sls pillar file in the same folder.

    Here an example to apply the recently created netweaver.sls pillar file to all of the nodes:

    # This file is /srv/pillar/top.sls
    base:
      '*':
        - netweaver
    
  4. Execute the formula.

    1. Master/Minion execution.

      salt '*' state.highstate

    2. Masterless execution.

      salt-call --local state.highstate

Important! The hostnames and minion names of the netweaver nodes must match the output of the hostname command.

Salt pillar encryption

Pillars are expected to contain private data such as user passwords required for the automated installation or other operations. Therefore, such pillar data need to be stored in an encrypted state, which can be decrypted during pillar compilation.

SaltStack GPG renderer provides a secure encryption/decryption of pillar data. The configuration of GPG keys and procedure for pillar encryption are desribed in the Saltstack documentation guide:

Note:

  • Only passwordless gpg keys are supported, and the already existing keys cannot be used.

  • If a masterless approach is used (as in the current automated deployment) the gpg private key must be imported in all the nodes. This might require the copy/paste of the keys.

OBS Packaging

The CI automatically publishes new releases to SUSE's Open Build Service every time a pull request is merged into master branch. For that, update the new package version in _service and add the new changes in sapnwbootstrap-formula.changes.

The new version is published at:

License

See the LICENSE file for license rights and limitations.

Author

Xabier Arbulu Insausti ([email protected])

Reviewers

Pull request preferred reviewers for this project:

sapnwbootstrap-formula's People

Contributors

arbulu89 avatar cschneemann avatar diegoakechi avatar mallozup avatar melzer-b1 avatar simranpal avatar stefanotorresi avatar yeoldegrove avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sapnwbootstrap-formula's Issues

improve documentation

I think that even if the formula is at begin, we should improve the documentation from the begin.

Currenlty the readme doesn't provide any info.

We should make clear statement about the specifications of the formula, it's behaviour, it's input (pillar) and how it is supposed to work

If there is already a pillar example, I assume that it should already work, so we should start to document asap 😁 hth

Improve the cluster resource template as per the suse best practises guide

Peter Schinagl identified some improvements to cluster_resources.j2. and differences to BestPractice SAP_NW740_SLE15 :

  1. "property cib-bootstrap-options" is only available for AWS
    and is different to BestPractice
    rsc_defaults rsc-options: is only available for AWS
    op_defaults op-options: is only available for AWS

  2. Structure of the cluster_resources could be grouped to made it better
    readable e.g. have all IP settings together as a block, similar for the other parts

  3. rsc_socat should be replaced by the azure-lb resource agent

  4. primitive rsc_sap_{{ sid }}_ASCS{{ ascs_instance }} SAPInstance
    op monitor interval=120 vs op monitor interval=11 on BestPractice;
    same for the ERS primitive

  5. ERS group has meta resource stickiness vs none on best BestPractice

https://documentation.suse.com/sbp/all/single-html/SAP_NW740_SLE15_SetupGuide/

`netweaver.setup` state is not idempotent

This is a tracker issue in order to improve the idempotency of our formulas

running for the 2nd time

salt-call --local             --log-level=error             --log-file=/var/log/salt-deployment.log             --log-file-level=debug             --retcode-passthrough          state.sls   netweaver.setup saltenv=base
          ID: label_partition
    Function: cmd.run
        Name: /usr/sbin/parted -s /dev/vdb mklabel gpt
      Result: False
     Comment: Command "/usr/sbin/parted -s /dev/vdb mklabel gpt" run
     Started: 20:51:57.973483
    Duration: 108.301 ms
     Changes:   
              ----------
              pid:
                  17175
              retcode:
                  1
              stderr:
                  Error: Partition(s) on /dev/vdb are being used.
              stdout:

and

---------
          ID: clean_nfs_sapmnt_HA1_00
    Function: file.absent
        Name: /sapmnt/HA1
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/lib/python3.6/site-packages/salt/modules/file.py", line 3793, in remove
                  shutil.rmtree(path)
                File "/usr/lib64/python3.6/shutil.py", line 486, in rmtree
                  _rmtree_safe_fd(fd, path, onerror)
                File "/usr/lib64/python3.6/shutil.py", line 424, in _rmtree_safe_fd
                  _rmtree_safe_fd(dirfd, fullname, onerror)
                File "/usr/lib64/python3.6/shutil.py", line 424, in _rmtree_safe_fd
                  _rmtree_safe_fd(dirfd, fullname, onerror)
                File "/usr/lib64/python3.6/shutil.py", line 424, in _rmtree_safe_fd
                  _rmtree_safe_fd(dirfd, fullname, onerror)
                File "/usr/lib64/python3.6/shutil.py", line 444, in _rmtree_safe_fd
                  onerror(os.unlink, fullname, sys.exc_info())
                File "/usr/lib64/python3.6/shutil.py", line 442, in _rmtree_safe_fd
                  os.unlink(name, dir_fd=topfd)
              OSError: [Errno 16] Device or resource busy: '.nfs000000000107399d00000001'
              
              During handling of the above exception, another exception occurred:
              
              Traceback (most recent call last):
                File "/usr/lib/python3.6/site-packages/salt/state.py", line 1987, in call
                  ret = self.states[cdata['full']](*cdata['args'], **cdata['kwargs'])
                File "/usr/lib/python3.6/site-packages/salt/loader.py", line 2031, in wrapper
                  return f(*args, **kwargs)
                File "/usr/lib/python3.6/site-packages/salt/states/file.py", line 1974, in absent
                  __salt__['file.remove'](name)
                File "/usr/lib/python3.6/site-packages/salt/modules/file.py", line 3797, in remove
                  'Could not remove \'{0}\': {1}'.format(path, exc)
              salt.exceptions.CommandExecutionError: Could not remove '/sapmnt/HA1': [Errno 16] Device or resource busy: '.nfs000000000107399d00000001'
     Started: 20:51:58.242216
    Duration: 6.282 ms
     Changes:   

The formula could not be used without a NFS-share

As in a distributed sap architecture and with HA we use a NFS-share for the NW profiles etc.
If the formula is not used in the above context, like single node/dual node deployment, the NFS part in the pillar and in the formula need to be manual deleted/uncommented before the deployment can start
It would be helpful to have a switch for such a usage without a nfs-share

issue with AD and group

So when deploying a netweaver with AD we have such failures.

Saltstack is trying to change /etc/groups file but this is a bug on salt because it should detect that the users/groups are coming from AD.

To mitigate such errors we have 2 solutions:

  1. why are we creating/modifing this users ? In hana the installer is doing all this. Maybe it the wrong approach (@arbulu89 why this?#18 and not let installer do the things? )
  2. instead of salt use cmd.run to do other calls compatible with AD
module.netweaver_node.module.netweaver_provision.null_resource.provision[3] (remote-exec): [ERROR   ] Command '['groupmod', '-g', 2002, 'sapsys']' failed with return code: 10
module.netweaver_node.module.netweaver_provision.null_resource.provision[3] (remote-exec): [ERROR   ] stdout: groupmod: group 'sapsys' does not exist in /etc/group
module.netweaver_node.module.netweaver_provision.null_resource.provision[3] (remote-exec): [ERROR   ] retcode: 10
module.netweaver_node.module.netweaver_provision.null_resource.provision[3] (remote-exec): [ERROR   ] Command '['groupmod', '-g', 2002, 'sapsys']' failed with return code: 10
module.netweaver_node.module.netweaver_provision.null_resource.provision[3] (remote-exec): [ERROR   ] output: groupmod: group 'sapsys' does not exist in /etc/group
module.netweaver_node.module.netweaver_provision.null_resource.provision[3] (remote-exec): [ERROR   ] {'Failed': {'gid': 2002}}
module.netweaver_node.module.netweaver_provision.null_resource.provision[3] (remote-exec): [ERROR   ] Encountered error checking for needed changes. Additional info follows:

module.netweaver_node.module.netweaver_provision.null_resource.provision[3] (remote-exec): - Changing uid (5001 -> 2001) not permitted, set allow_uid_change to True to force this change. Note that this will not change file ownership.
module.netweaver_node.module.netweaver_provision.null_resource.provision[3] (remote-exec): - Changing gid (79 -> 2002) not permitted, set allow_gid_change to True to force this change. Note that this will not change file ownership.
module.netweaver_node.module.netweaver_provision.null_resource.provision[2] (remote-exec): [ERROR   ] Command '['groupmod', '-g', 2002, 'sapsys']' failed with return code: 10
module.netweaver_node.module.netweaver_provision.null_resource.provision[2] (remote-exec): [ERROR   ] stdout: groupmod: group 'sapsys' does not exist in /etc/group
module.netweaver_node.module.netweaver_provision.null_resource.provision[2] (remote-exec): [ERROR   ] retcode: 10
module.netweaver_node.module.netweaver_provision.null_resource.provision[2] (remote-exec): [ERROR   ] Command '['groupmod', '-g', 2002, 'sapsys']' failed with return code: 10
module.netweaver_node.module.netweaver_provision.null_resource.provision[2] (remote-exec): [ERROR   ] output: groupmod: group 'sapsys' does not exist in /etc/group
module.netweaver_node.module.netweaver_provision.null_resource.provision[2] (remote-exec): [ERROR   ] {'Failed': {'gid': 2002}}
module.netweaver_node.module.netweaver_provision.null_resource.provision[2] (remote-exec): [ERROR   ] Encountered error checking for needed changes. Additional info follows:

module.netweaver_node.module.netweaver_provision.null_resource.provision[2] (remote-exec): - Changing uid (5001 -> 2001) not permitted, set allow_uid_change to True to force this change. Note that this will not change file ownership.
module.netweaver_node.module.netweaver_provision.null_resource.provision[2] (remote-exec): - Changing gid (79 -> 2002) not permitted, set allow_gid_change to True to force this change. Note that this will not change file ownership.
module.netweaver_node.module.netweaver_provision.null_resource.provision[2] (remote-exec): [ERROR   ] Command '['groupmod', '-g', 2002, 'sapsys']' failed with return code: 10
module.netweaver_node.module.netweaver_provision.null_resource.provision[2] (remote-exec): [ERROR   ] stdout: groupmod: group 'sapsys' does not exist in /etc/group
module.netweaver_node.module.netweaver_provision.null_resource.provision[2] (remote-exec): [ERROR   ] retcode: 10
module.netweaver_node.module.netweaver_provision.null_resource.provision[2] (remote-exec): [ERROR   ] Command '['groupmod', '-g', 2002, 'sapsys']' failed with return code: 10
module.netweaver_node.module.netweaver_provision.null_resource.provision[2] (remote-exec): [ERROR   ] output: groupmod: group 'sapsys' does not exist in /etc/group
module.netweaver_node.module.netweaver_provision.null_resource.provision[2] (remote-exec): [ERROR   ] {'Failed': {'gid': 2002}}
module.netweaver_node.module.netweaver_provision.null_resource.provision[2] (remote-exec): [ERROR   ] Encountered error checking for needed changes. Additional info follows:

pillar example show inconsitent settings and miss whats possible as parameters

the pillar.example should be show a good working example. This is not true right now, as for example many key/value pairs which are OR possibilities are all enabled.
Second there is no example or further documentation of some important possible settings, like extra_parameters for some common actual SAP setups (e.g. S/4)

the sap media structure is different for different sap version - should be unique

as documented in the terraform project, the sap media structure the formula uses need to be different for different sap swpm versions and products.
This is not the case if you use the sap install manual. This confuses customers and make a successful usage of the formula hard.
I would propose a general structure like such below (which other projects use too)

├SWPM_CD
│  ├SWPM20SP07_5-80003424.SAR
│  └SAPCAR_721-20010450.EXE
│  
├EXP_CD
│  ├S4CORE104_INST_EXPORT_1.zip
│  ├S4CORE104_INST_EXPORT_2.zip
│  └...
├DBCLIENT_CD
│  └IMDB_CLIENT20_005_111-80002082.SAR
├BASKET_CD
│   ├SAPHOSTAGENT24_24-20009394.SAR
│   ├igshelper_4-10010245.sar
│   ├igsexe_1-80001746.sar
│   ├SAPEXEDB_400-80000698.SAR^
│   └SAPEXE_400-80000699.SAR
└HANA
    ├51053061_part1.exe
    ├51053061_part2.rar
    ├51053061_part3.rar          
    └51053061_part4.rar

BASKET_ CD : contains SAP kernel, patch + more, like hostagent.
DBCLIENT_CD: contains the package corresponding to DB CLIENT, e.g HANA
EXP_CD : contains the package corresponding to EXPORT files
SWPM_CD : must contain the .exe file corresponding to SAPCAR and the .sar file corresponding to SWPM. The file suffix must be .exe and .sar.

virtual ip adresses used in the pillar are not persistent

if the formula is used standalone and without a cluster, the virtual ip addresses used for the different sap instances (as,er,db,pas,aas, ...) are gone after a reboot.

They are not persistence as they are not written into the /etc/icfg- file.

They simply need to be append to the /etc/sysconfig/network/ifcfg-ethX file like
IPADDR_1=192.168.201.115/24
IPADDR_2=192.168.201.116/24
IPADDR_3=192.168.201.117/24
IPADDR_4=192.168.201.118/24
...

Add port pillar for exporter

In the future, I would add the option to select the port and log level from the formula.

for sap_host_exporter

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.