#
set -u
#
#
##############################
#
# call specific setup
# CIBREMOTE - set user@host to define where to run the changes, empty for localhost
# WOW_SIMULATE - set to yes to get an simutate output; set to no to run real updates
#
CIBREMOTE=root@zsap00
WOW_SIMULATE=yes
#
##############################
#
# cluster specific setup
# ALLNODES - set the cluster node names separated by a blank 
# NRNODES - set to number of nodes (should be set automatically)
#
ALLNODES="zsap00 zsap01"
NRNODES="$(echo $ALLNODES | wc -w)"
#
##############################
#
# ipmi specific setup
# IPMIADDRESSES - list of ipmi board adresses for all nodes; list items are seaparated by blanks and must match the oder of the cluster node definition (ALLNODES)
# IPMISETTINGS -  definition of the cluster wide ipmi settings such as ipmi userid and ipmi password
#
IPMIADDRESSES='10.11.10.100 10.11.10.101'
IPMISETTINGS="IPMI_USERID=root IPMI_PASSWD=pwd IPMI_STATUSMODE=ok"
#
#############################
#
# sap resource definition
# GRPID - Define your SAP resource group name here; default is grp_sap_$SAPSID
# SAP_SCORES - Scores to run the entrire sap group on the first, second, ... node; the list items are separated by blanks; the order must match the cluster node definition (ALLNODES)
# IP_LABELS - list of ipnames and ipadresses to be configured as resouces for the group; each list item has the format name,address; list items are separated by blanks
# SAPSID - SAP system id like C11, WAS or WOW (upper case); Is there anybody out there, which could remeber the good old C11 SAP1.1 systems?
# SAPsid - automatically set SAP system id in lower case
# SAP_INSTANCE_DEF - Table with definition of the SAP instances; each row defines the instance type; instance name; profile path and optional parameters which might be needed by more complex resource definitions; 
# SFEX_DEVICE -	defines the path of the sfex devices to be used to add more security to the cluster
# SFEX2_DEVICES - defines the paths of two parallel sfex devices to be used for special cases
# SFEXID - defaults to 1; needs to be set, when you need to have more than one sfex device in different groups
# SFEX_INDEX - defines the sfex index (default to be used 1)
# RAID1_DEVICES - defines the paths of the md devices to be used in the resource group
# RAID_CONFIG - defines the path of the raid configuration file for cluster controlled md devices
# LVM_VOLUMEGROUPS - defines the list of volume groups to be used
# FS_FILESYSTEMS - here document to make the defintion more easy for standard cases
#
SAPSID=C11
#
DBTYPE=ORA
#
GRPID=grp_sap_$SAPSID
#
SAP_SCORES="1000 0"
#
IP_LABELS="zsapc11,10.10.10.10"
#
SAPsid=$(echo $SAPSID|tr [:upper:] [:lower:])
#
### SAP Instances
#
SAP_INSTANCE_DEF=$(cat <<HERE-SAP
# instance-typ instance-name                  profile-path                                                  optional-parameters
SCS            ${SAPSID}_SCS01_zsapsagpi      /usr/sap/${SAPSID}/SYS/profile/${SAPSID}_SCS01_zsapsagpi
DS             ${SAPSID}_DVEBMGS02_zsapsagpi  /usr/sap/${SAPSID}/SYS/profile/${SAPSID}_DVEBMGS02_zsapsagpi  START_WAITTIME=30
HERE-SAP
)
#
### IO stack
#
echo "CHECK: define the correct sfex devices"
SFEX_DEVICE="/dev/disk/by-name/36005076304ffc3eb000000000000445e"
SFEX2_DEVICES="/dev/disk/by-name/36005076304ffc3eb000000000000445e /dev/disk/by-name/36005076304ffc3b3000000000000445e"
SFEX_INDEX=1
#
RAID1_DEVICES="/dev/md0 /dev/md1 /dev/md2 /dev/md3"
RAID_CONFIG="/clusterconf/$SAPSID/mdadm.conf"
#
LVM_VOLUMEGROUPS="${SAPsid}_oradg ${SAPsid}_log1dg ${SAPsid}_log2dg ${SAPsid}_sapdg"
#
FS_FILESYSTEMS=$(cat <<HERE-FS
/dev/${SAPsid}_oradg/lv_ora${SAPsid}                /oracle/${SAPSID}			ora_${SAPSID}
/dev/${SAPsid}_oradg/lv_${SAPsid}_102_64            /oracle/${SAPSID}/102_64		ora_${SAPSID}_102_64
/dev/${SAPsid}_oradg/lv_${SAPsid}_sapdata1          /oracle/${SAPSID}/sapdata1		ora_${SAPSID}_sapdata1
/dev/${SAPsid}_oradg/lv_${SAPsid}_sapdata2          /oracle/${SAPSID}/sapdata2		ora_${SAPSID}_sapdata2
/dev/${SAPsid}_oradg/lv_${SAPsid}_sapdata3          /oracle/${SAPSID}/sapdata3		ora_${SAPSID}_sapdata3
/dev/${SAPsid}_oradg/lv_${SAPsid}_sapdata4          /oracle/${SAPSID}/sapdata4		ora_${SAPSID}_sapdata4

/dev/${SAPsid}_log2dg/lv_${SAPsid}_saparch          /oracle/${SAPSID}/saparch		ora_${SAPSID}_saparch

/dev/${SAPsid}_log1dg/lv_${SAPsid}_origlogA         /oracle/${SAPSID}/origlogA		ora_${SAPSID}_origlogA
/dev/${SAPsid}_log1dg/lv_${SAPsid}_origlogB         /oracle/${SAPSID}/origlogB		ora_${SAPSID}_origlogB

/dev/${SAPsid}_log2dg/lv_${SAPsid}_mirrlogA         /oracle/${SAPSID}/mirrlogA		ora_${SAPSID}_mirrorlogA
/dev/${SAPsid}_log2dg/lv_${SAPsid}_mirrlogB         /oracle/${SAPSID}/mirrlogB		ora_${SAPSID}_mirrorlogB

/dev/${SAPsid}_sapdg/lv_sapmnt                      /sapmnt/${SAPSID}  			sapmnt_${SAPSID}
/dev/${SAPsid}_sapdg/lv_usrsap                      /usr/sap/${SAPSID}			usrsap_${SAPSID}
HERE-FS
)
#
echo "OK Settings END"
