version: 2.2
category: SAP
shortdesc: SAP SimpleStack+ Instance
longdesc: |
  Configure a SAP instance including:

  1) Virtual IP addresses for each of the SAP instance services - ASCS, DB and CI,

  2) A RAID 1 host based mirror,

  3) A cluster manager LVM volume group and LVM volumes on the RAID 1 host based mirror,

  4) File systems on shared storage for sapmnt, /sapbd, /usr/sap/SID/ASCS## and /usr/sap/SID/DVEBMGS##,

  5) SAPinstance for - ASCS, a Database, a Central Instance.

  The difference between this and the SimpleStack is that the ASCS and CI have their own
  volumes / file systems / mount points rather than just one volume / file system / mount point on /usr/sap.

parameters:
  - name: id
    shortdesc: SAP SimpleStack+ Resource Group ID
    longdesc: Unique ID for the SAP SimpleStack+ instance resource group in the cluster.
    required: true
    type: resource
    value: grp_sap_NA0

include:
  - script: raid1
    required: true
    parameters:
      - name: raidconf
        value: "/etc/mdadm.conf"
      - name: raiddev
        value: "/dev/md0"

  - script: lvm
    required: true
    shortdesc: LVM logical volumes for the SAP file systems.
    parameters:
      - name: volgrpname
        value: sapvg

  - script: filesystem
    name: filesystem-sapmnt
    required: true
    shortdesc: File system resource for the sapmnt directory.
    parameters:
      - name: id
        value: rsc_fs_NA0_sapmnt
      - name: directory
        value: "/sapmnt"
      - name: options
        value: "noatime,barrier=0,data=writeback"
    ops: |
      op stop timeout=300
      op monitor interval=30 timeout=130

  - script: filesystem
    name: filesystem-usrsap
    required: true
    shortdesc: File system resource for the /usr/sap directory.
    parameters:
      - name: id
        value: rsc_fs_NA0_usrsap
      - name: directory
        value: "/usr/sap"
      - name: options
        value: "noatime,barrier=0,data=writeback"
    ops: |
      op stop timeout=300
      op monitor interval=30 timeout=130

  - script: sapdb
    required: true

  - script: virtual-ip
    name: virtual-ip-db
    shortdesc: The Virtual IP address configured here will be for the SAP Database instance.
    required: true
    parameters:
      - name: id
        value: rsc_ip_NA0_sapna0db
      - name: ip
        value: 172.17.2.54
      - name: cidr_netmask
        value: 24
      - name: nic
        value: eth0
  - script: filesystem
    name: filesystem-db
    shortdesc: "File system resource for the SAP database (typically /sapdb)."
    longdesc: >-
      If a file system does not already exist on the block device 
      specified here, you will need to run mkfs to create it, prior 
      to starting the file system resource.  You will also need
      to create the mount point directory on all cluster nodes.
    parameters:
      - name: id
        value: rsc_fs_NA0_sapna0db
      - name: directory
        value: "/sapdb"
      - name: options
        value: "noatime,barrier=0,data=writeback"
    ops: |
      op stop timeout=300
      op monitor interval=30 timeout=130          

  - script: sapinstance
    name: sapinstance-as
    required: true
    parameters:
      - name: id
        value: rsc_sapinst_NA0_ASCS00_sapna0as
      - name: InstanceName
        value: NA0_ASCS00_sapna0as
      - name: START_PROFILE
        value: "/usr/sap/NA0/SYS/profile/START_ASCS00_sapna0as"
  - script: virtual-ip
    name: virtual-ip-as
    shortdesc: The Virtual IP address configured here will be for the SAP ASCS instance.
    required: true
    parameters:
      - name: id
        value: rsc_ip_NA0_sapna0as
      - name: ip
        value: 172.17.2.53
      - name: cidr_netmask
        value: 24
      - name: nic
        value: eth0
  - script: filesystem
    name: filesystem-as
    shortdesc: "File system resource for the /usr/sap/SID/ASCS## directory."
    longdesc: >-
      If a file system does not already exist on the block device 
      specified here, you will need to run mkfs to create it, prior 
      to starting the file system resource.  You will also need
      to create the mount point directory on all cluster nodes.
    parameters:
      - name: id
        value: rsc_fs_NA0_sapna0as
      - name: directory
        value: "/usr/sap/NA0/ASCS00"
      - name: options
        value: "noatime,barrier=0,data=writeback"
    ops: |
      op stop timeout=300
      op monitor interval=30 timeout=130          

  - script: sapinstance
    name: sapinstance-ci
    required: true
    parameters:
      - name: id
        value: rsc_sapinst_NA0_DVEBMGS01_sapna0ci
      - name: InstanceName
        value: NA0_DVEBMGS01_sapna0ci
      - name: START_PROFILE
        value: "/usr/sap/NA0/SYS/profile/START_DVEBMGS01_sapna0ci"
  - script: virtual-ip
    name: virtual-ip-ci
    shortdesc: The Virtual IP address configured here will be for the SAP Central instance.
    required: true
    parameters:
      - name: id
        value: rsc_ip_NA0_sapna0ci
      - name: ip
        value: 172.17.2.55
      - name: cidr_netmask
        value: 24
      - name: nic
        value: eth0
  - script: filesystem
    name: filesystem-ci
    shortdesc: "File system resource for the /usr/sap/SID/DVEBMGS## directory."
    longdesc: >-
      If a file system does not already exist on the block device 
      specified here, you will need to run mkfs to create it, prior 
      to starting the file system resource.  You will also need
      to create the mount point directory on all cluster nodes.
    parameters:
      - name: id
        value: rsc_fs_NA0_sapna0ci
      - name: directory
        value: "/usr/sap/NA0/DVEBMGS01"
      - name: options
        value: "noatime,barrier=0,data=writeback"
    ops: |
      op stop timeout=300
      op monitor interval=30 timeout=130          

actions:
  - include: raid1
  - include: lvm
  - include: filesystem-sapmnt
  - include: filesystem-db
  - include: filesystem-ci
  - include: filesystem-as
  - include: virtual-ip-ci
  - include: virtual-ip-db
  - include: virtual-ip-as
  - include: sapdb
  - include: sapinstance-as
  - include: sapinstance-ci
  - cib:
      group {{id}}
        {{raid1:id}}
        {{lvm:id}}
        {{virtual-ip-db:id}}
        {{filesystem-sapmnt:id}}
        {{filesystem-db:id}}
        {{sapdb:id}}
        {{virtual-ip-as:id}}
        {{filesystem-as:id}}
        {{sapinstance-as:id}}
        {{virtual-ip-ci:id}}
        {{filesystem-ci:id}}
        {{sapinstance-ci:id}}
        meta target-role=Stopped
