Puppet Class: tomcat
- Defined in:
- modules/tomcat/manifests/init.pp
Summary
module to install and configure tomcatOverview
SPDX-License-Identifier: Apache-2.0
3 4 5 6 7 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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'modules/tomcat/manifests/init.pp', line 3
class tomcat (
Stdlib::Host $hostname = 'localhost',
String[1] $user = 'tomcat',
String[1] $group = 'tomcat',
String $app_base = 'webapps',
Boolean $unpack_wars = true,
Boolean $auto_deploy = true,
Stdlib::Port $connector_port = 8080,
Integer $connector_timeout = 20000,
Stdlib::Unixpath $config_basedir = '/etc/tomcat9',
Boolean $versionlogger_listener = true,
Boolean $security_listener = false,
Boolean $apr_listener = false,
Boolean $apr_sslengine = false,
Stdlib::Port::User $apr_port = 8443,
Boolean $userdatabase_realm = false,
String[1] $userdatabase_file = 'tomcat-users.xml',
String[1] $logs_dir = 'logs',
String[1] $log_pattern = 'combined',
Integer[1] $default_session_timeout = 30,
Boolean $default_servlet_debug = false,
Boolean $default_servlet_listings = false,
Boolean $default_servlet_readonly = true,
Array[String[1]] $default_servlet_mappings = ['/'],
Boolean $jsp_servlet_fork = false,
Boolean $jsp_servlet_xpoweredby = false,
Array[String[1]] $jsp_servlet_mappings = ['*.jsp', '*.jspx'],
Array[String[1]] $welcome_files = ['index.html', 'index.htm', 'index.jsp'],
Stdlib::Host $shutdown_address = 'localhost',
String $shutdown_string = 'SHUTDOWN',
Stdlib::Unixpath $public_key_path = '/etc/tomcat9/ssl/cert.pem',
Stdlib::Unixpath $private_key_path = '/etc/tomcat9/ssl/server.key',
Hash[String[1], String[1]] $java_opts = {'java.awt.headless' => 'true',
'log4j2.formatMsgNoLookups' => 'true'},
Array[String[1]] $watched_resources = ['WEB-INF/web.xml',
'WEB-INF/tomcat-web.xml',
# lint:ignore:single_quote_string_with_variables
'${catalina.base}/conf/web.xml'],
# lint:endignore
Optional[Stdlib::Port] $shutdown_port = undef,
){
if debian::codename::eq('bullseye') {
ensure_packages(['tomcat9'])
}
if debian::codename::eq('bookworm') {
apt::package_from_component { 'tomcat9-forwardport':
component => 'component/tomcat9',
packages => ['libtomcat9-java', 'tomcat9', 'tomcat9-common'],
priority => 1002,
}
}
if $apr_listener {
ensure_packages(['libtcnative-1'])
}
$_java_opts = $java_opts.reduce('') |$memo, $value| { "-D${value[0]}=${value[1]} ${memo}" }.strip
file{
default:
ensure => file,
owner => 'root',
mode => '0640',
group => $group,
notify => Service['tomcat9'];
$config_basedir:
ensure => directory;
"${config_basedir}/server.xml":
content => template('tomcat/server.xml.erb');
"${config_basedir}/context.xml":
content => template('tomcat/context.xml.erb');
"${config_basedir}/web.xml":
content => template('tomcat/web.xml.erb');
'/etc/default/tomcat9':
mode => '0644',
group => 'root',
content => "JAVA_OPTS=\"${_java_opts}\"\n";
}
service{'tomcat9':
ensure => 'running',
enable => true,
}
}
|