Puppet Class: sap::management::dotfiles

Defined in:
manifests/management/dotfiles.pp

Summary

Manages the dotfiles belonging to SAP users.

Overview

This is an internal class and should not be called directly. If $bash_source_profile is set to true for the instance as a whole this class will be enabled and will cause the .bash_profile of the sid_adm and db2 users to source their ‘.profile’.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'manifests/management/dotfiles.pp', line 8

class sap::management::dotfiles {
  if $facts['sap'] != undef {
    $sid_hash = $facts['sap']['sid_hash']
  } else {
    $sid_hash = {}
  }

  $sid_hash.each |$sid, $data| {
    $sid_lower = downcase($sid)
    $sidadm = "${sid_lower}adm"

    # Skip SID entries which don't have instances
    unless('instances' in $data) { next() }

    $instances = $data['instances']

    # Skip SIDs with an empty instance structure
    if empty($instances) { next() }

    # Create the <sid>adm user bash profile
    file { "${sidadm}_bash_profile":
      ensure         => 'present',
      path           => "/home/${sidadm}/.bash_profile",
      owner          => $sidadm,
      group          => 'sapsys',
      mode           => '0644',
      content        => file('sap/sidadm_bash_profile'),
      checksum       => 'sha256',
      checksum_value => 'fd59129b812b607e2f7989742ac65fafa81a3c059588db970582945c1645b947',
    }

    # Create Database (db2<sid>) user .bash_profile
    if 'database' in $instances {
      $db_type = $instances['database']['type']
      case $db_type {
        'db2': {
          file { "db2${sid_lower}_bash_profile":
            ensure         => 'present',
            path           => "/db2/db2${sid_lower}/.bash_profile",
            owner          => "db2${sid_lower}",
            group          => "db${sid_lower}adm",
            mode           => '0644',
            content        => file('sap/sidadm_bash_profile'),
            checksum       => 'sha256',
            checksum_value => 'fd59129b812b607e2f7989742ac65fafa81a3c059588db970582945c1645b947',
          }
        }
        default: {}
      }
    }
  }
}