Puppet Class: aem_stack_manager

Defined in:
manifests/init.pp

Summary

Install and configure the Shine Solution Stack Manager for Adobe Experience Manager

Overview

Copyright © 2017 Shine Solutions Group, unless otherwise noted.

Examples:

Declaring the class

include aem_stack_manager

Parameters:

  • service_name (String)

    The name of the service when it is installed. Defaults to aem-stack-manager and several other variables are based on it. You probably shouldn't change this.

  • basedir (String)

    Path to the base directory for installation. Defaults to '/opt/shinesolutions' and several other paths are based on it.

  • installdir (String)

    Path to the directory for installation. The JAR file and configuration files are installed here. Defaults to <basedir>/<service_name>.

  • homedir (String)

    Path to the home directory for the user the service runs as. Only used if <manage_homedir> is true.

  • user (String)

    The user the service runs as. Defaults to <service_name>.

  • group (String)

    The primary group for user the service runs as. Defaults to <service_name>.

  • jarfile_source (String)

    Source URL for the AEM Stack Manager JAR file.

  • jarfile_checksum_value (String)

    Checksum of the AEM Stack Manager JAR file. If not specified and an HTTP URL is used, Puppet will treat the File resource as updated on every run.

  • jarfile_checksum_type (String) (defaults to: 'sha256')

    The checksum algorithm used to produce jarfile_checksum_value.

  • jarfile_mode (String) (defaults to: '0500')

    File mode for the JAR file.

  • manage_basedir (Boolean) (defaults to: true)

    Whether or not to manage <basedir> as a resource in Puppet.

  • manage_installdir (Boolean) (defaults to: false)

    Whether or not to manage <installdir> as a resource in Puppet.

  • manage_homedir (Boolean) (defaults to: true)

    Whether or not to manage <homedir> as a resource in Puppet.

  • manage_user (Boolean) (defaults to: true)

    Whether or not to manage <user> as a resource in Puppet.

  • manage_group (Boolean) (defaults to: true)

    Whether or not to manage <group> as a resource in Puppet.

  • aws_profile (Variant[String, Undef]) (defaults to: undef)

    If specified, sets the AWS_PROFILE variable in the service's environment.

Author:



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'manifests/init.pp', line 65

class aem_stack_manager (
  String $service_name,
  String $basedir,
  String $installdir,
  String $homedir,
  String $user,
  String $group,

  String $jarfile_source,
  String $jarfile_checksum_value,
  String $jarfile_checksum_type = 'sha256',
  String $jarfile_mode          = '0500',

  Boolean $manage_basedir    = true,
  Boolean $manage_installdir = false,
  Boolean $manage_homedir    = true,
  Boolean $manage_user       = true,
  Boolean $manage_group      = true,

  Variant[String, Undef] $aws_profile = undef,
){
  if $manage_basedir {
    file { $basedir:
      ensure => directory,
    }
    $basedir_require = File[$basedir]
  } else {
    $basedir_require = undef
  }
  if $manage_user {
    group { $group:
      ensure => present,
      system => true,
    }
    user { $user:
      ensure     => present,
      home       => $homedir,
      managehome => $manage_homedir,
      system     => true,
      shell      => '/usr/sbin/nologin',
      gid        => $group,
      expiry     => absent,
    }
  }
  if $manage_installdir {
    file { [ $installdir ]:
      ensure  => directory,
      owner   => $user,
      group   => $group,
      require => [ $basedir_require, User[$user] ],
    }
    $file_requires = [ File[$installdir], User[$user] ]
  } else {
    $file_requires = [ User[$user] ]
  }

  $jarfile = "${installdir}/aem-stack-manager.jar"
  $servicefile = "/etc/systemd/system/${service_name}.service"
  archive { $jarfile:
    ensure        => present,
    source        => $jarfile_source,
    checksum_type => $jarfile_checksum_type,
    checksum      => $jarfile_checksum_value,
    require       => $file_requires;
  }
  -> file { $jarfile:
    owner => $user,
    group => $group,
    mode  => $jarfile_mode,
  }

  if $facts['os']['family'] == 'redhat' {
    file { $servicefile:
      ensure  => file,
      content => template('aem_stack_manager/service.conf.erb'),
      require => File[$jarfile],
    }
  }

  class { '::aem_stack_manager::application_properties':
    path    => "${installdir}/application.properties",
    owner   => $user,
    group   => $group,
    notify  => Service[$service_name],
    require => File[$servicefile],
  }

  service { $service_name:
    ensure => running,
    enable => true,
  }
}