Puppet Class: simianarmy

Defined in:
manifests/init.pp

Summary

Install and configure the Netflix Simian Army

Overview

Copyright © 2017 Shine Solutions Group, unless otherwise noted.

Examples:

include simianarmy

Parameters:

  • service_name (String)

    The name of the service when it is installed. Defaults to simianarmy 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/netflix' and several other paths are based on it.

  • basedir_mode (String) (defaults to: '0755')

    File mode for the base directory.

  • installdir (String)

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

  • installdir_mode (String) (defaults to: '0750')

    File mode for the installation directory.

  • 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>.

  • warfile_source (String)

    Source URL for the Netflix Simian Army JAR file.

  • warfile_checksum_value (String)

    Checksum of the Netflix Simian Army file. If not specified and an HTTP URL is used, Puppet will treat the File resource as updated on every run.

  • 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.

  • manage_package (Boolean) (defaults to: true)

    Whether or not to manage the installation of package <tomcat_pkg_name>.

  • warfile_checksum_value

    Checksum type used for warfile_checksum_value.

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

    The checksum algorithm used to produce warfile_checksum_value.

  • warfile_mode (String) (defaults to: '0400')

    File mode for the WAR file.

  • shell (String) (defaults to: '/usr/sbin/nologin')

    shell for the user to run tomcat

  • tomcat_pkg_name (String) (defaults to: 'tomcat')

    platform specific tomcat package name

  • tomcat_srv_name (String) (defaults to: 'tomcat')

    platform specific tomcat service name

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

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

Author:



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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'manifests/init.pp', line 86

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

  String $warfile_source,
  String $warfile_checksum_value,
  String $warfile_checksum_type = 'sha256',
  String $warfile_mode          = '0400',

  String $basedir_mode    = '0755',
  String $installdir_mode = '0750',

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

  String $shell = '/usr/sbin/nologin',
  String $tomcat_pkg_name = 'tomcat',
  String $tomcat_srv_name = 'tomcat',

  Variant[String, Undef] $aws_profile = undef,
){
  if $manage_basedir {
    file { $basedir:
      ensure => directory,
      mode   => $basedir_mode,
    }
    $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      => $shell,
      gid        => $group,
      expiry     => absent,
    }
  }
  if $manage_installdir {
    file { [ $installdir ]:
      ensure  => directory,
      owner   => $user,
      group   => $group,
      mode    => $installdir_mode,
      require => [ $basedir_require, User[$user] ],
    }
    $file_requires = [ File[$installdir], User[$user] ]
  } else {
    $file_requires = [ User[$user] ]
  }

  $warfile = "${homedir}/${service_name}.war"
  $webapp_path = "${installdir}/${service_name}"

  if $manage_package {
    package { [ $tomcat_pkg_name ]:
      ensure => latest,
      before => File[$webapp_path],
    }
  }

  file { $webapp_path:
    ensure => directory,
    owner  => $user,
    group  => 'tomcat',
    mode   => '0750',
  }
  -> archive { $warfile:
    ensure        => present,
    source        => $warfile_source,
    extract       => true,
    extract_path  => $webapp_path,
    creates       => "${webapp_path}/WEB-INF",
    user          => $user,
    group         => 'tomcat',
    checksum_type => $warfile_checksum_type,
    checksum      => $warfile_checksum_value,
  }
  -> file { $warfile:
    owner => $user,
    group => $group,
    mode  => $warfile_mode,
  }
  -> class {
    [
      '::simianarmy::chaos_properties',
      '::simianarmy::client_properties',
      '::simianarmy::conformity_properties',
      '::simianarmy::janitor_properties',
      '::simianarmy::log4j_properties',
      '::simianarmy::simianarmy_properties',
      '::simianarmy::volume_tagging_properties',
    ]:
      owner => $user,
      group => 'tomcat',
  }
  -> service { $tomcat_srv_name:
    ensure => running,
    enable => true,
  }
}