Skip to content

Commit

Permalink
[profiles] tomcat: new profile for aco-tomcat
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Kalb committed Aug 1, 2016
1 parent bd94d72 commit 2831e42
Show file tree
Hide file tree
Showing 3 changed files with 172 additions and 1 deletion.
68 changes: 68 additions & 0 deletions hiera/data/defaults/profiles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1847,4 +1847,72 @@ profiles::radius_server::nagios_services:
'service_description': 'radiusd'
'check_command': 'check_service!radiusd'

### Tomcat configuration

## Installation Parameters
# No need to change if installing default package from repo

# valid values are 'package' or 'archive'
profiles::tomcat::install_from: 'package'
# only set if not using default rhel package
profiles::tomcat::package_name: null

# valid format is 'x.y.z[-package_suffix]', used for archive
profiles::tomcat::version: null
# url of tarball for tomcat installation
profiles::tomcat::archive_source: null
# only for custom packages or archives
profiles::tomcat::config_path: null
profiles::tomcat::catalina_home: null
profiles::tomcat::catalina_pid: null
profiles::tomcat::log4j: false

## Common & Administrative Parameters

profiles::tomcat::admin_webapps: true
profiles::tomcat::create_default_admin: true
profiles::tomcat::admin_user: 'admin'
profiles::tomcat::admin_password: 'admin'

## Server Configuration

# threadpool executor
profiles::tomcat::threadpool_executor: false
profiles::tomcat::threadpool_maxthreads: 100
profiles::tomcat::threadpool_minsparethreads: 5

# http configuration
profiles::tomcat::http_connector: true
profiles::tomcat::http_port: 8080
# make sure you enable thread_poolexecutor if you set below to true
profiles::tomcat::http_use_threadpool: false
profiles::tomcat::http_params: null

# https configuration
profiles::tomcat::ssl_connector: true
profiles::tomcat::ssl_port: 8443
profiles::tomcat::ssl_keystorefile: '/etc/pki/java/keystore.jks'
# make sure you enable thread_poolexecutor if you set below to true
profiles::tomcat::ssl_use_threadpool: false
profiles::tomcat::ssl_params: null

# ajp configuration
profiles::tomcat::ajp_connector: true
profiles::tomcat::ajp_port: 8009
# make sure you enable thread_poolexecutor if you set below to true
profiles::tomcat::ajp_use_threadpool: false
profiles::tomcat::ajp_params: null

# java configuration
profiles::tomcat::java_home: null
profiles::tomcat::java_opts:
- '-server'
- '-Xmx2048m'
- '-Xms256m'
- '-XX:+UseConcMarkSweepGC'

# host configuration (set to hostname of machine)
profiles::tomcat::host_name: '%{::fqdn}'
profiles::tomcat::host_autodeploy: true

###
103 changes: 103 additions & 0 deletions modules/knack/profiles/manifests/tomcat.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# == Class: profiles::tomcat
#
# This profile configures a node with an instance of Apache Tomcat
#
# The documentation for each of the variables are located in the Hiera profile
# No variables are required, tomcat will install w/ default configurations (ssl,http,ajp) with no changes.
#

class profiles::tomcat (
$install_from = hiera('profiles::tomcat::install_from'),
$package_name = hiera('profiles::tomcat::package_name', undef),
$version = hiera('profiles::tomcat::version', undef),
$archive_source = hiera('profiles::tomcat::archive_source', undef),
$config_path = hiera('profiles::tomcat::config_path', undef),
$catalina_home = hiera('profiles::tomcat::catalina_home', undef),
$catalina_pid = hiera('profiles::tomcat::catalina_pid', undef),
$log4j = hiera('profiles::tomcat::log4j'),

$admin_password = hiera('profiles::tomcat::admin_password', undef),
$admin_user = hiera('profiles::tomcat::admin_user'),
$create_default_admin = hiera('profiles::tomcat::create_default_admin'),
$admin_webapps = hiera('profiles::tomcat::admin_webapps'),

$threadpool_executor = hiera('profiles::tomcat::threadpool_executor'),
$threadpool_maxthreads = hiera('profiles::tomcat::threadpool_maxthreads'),
$threadpool_minsparethreads = hiera('profiles::tomcat::threadpool_minsparethreads'),

$http_connector = hiera('profiles::tomcat::http_connector'),
$http_port = hiera('profiles::tomcat::http_port'),
$http_use_threadpool = hiera('profiles::tomcat::http_use_threadpool'),
$http_params = hiera('profiles::tomcat::http_params', undef),

$ajp_connector = hiera('profiles::tomcat::ajp_connector'),
$ajp_port = hiera('profiles::tomcat::ajp_port'),
$ajp_use_threadpool = hiera('profiles::tomcat::ajp_use_threadpool'),
$ajp_params = hiera('profiles::tomcat::ajp_parms', undef),

$ssl_connector = hiera('profiles::tomcat::ssl_connector'),
$ssl_port = hiera('profiles::tomcat::ssl_port'),
$ssl_keystorefile = hiera('profiles::tomcat::ssl_keystorefile'),
$ssl_params = hiera('profiles::tomcat::ssl_params', undef),

$java_home = hiera('profiles::tomcat::java_home', undef),
$java_opts = hiera('profiles::tomcat::java_opts'),
$host_name = hiera('profiles::tomcat::host_name', 'localhost'),
$host_autodeploy = hiera('profiles::tomcat::host_autodeploy')
) {

class { 'tomcat':

install_from => $install_from,
package_name => $package_name,
version => $version,
archive_source => $archive_source,
config_path => $config_path,
catalina_home => $catalina_home,
catalina_pid => $catalina_pid,
log4j => $log4j,

admin_webapps => $admin_webapps,
create_default_admin => $create_default_admin,
admin_user => $admin_user,
admin_password => $admin_password,

threadpool_executor => $threadpool_executor,
threadpool_maxthreads => $threadpool_maxthreads,
threadpool_minsparethreads => $threadpool_minsparethreads,

http_connector => $http_connector,
http_port => $http_port,
http_use_threadpool => $http_use_threadpool,
http_params => $http_params,

ajp_connector => $ajp_connector,
ajp_port => $ajp_port,
ajp_use_threadpool => $ajp_use_threadpool,
ajp_params => $ajp_params,

ssl_connector => $ssl_connector,
ssl_port => $ssl_port,
ssl_keystorefile => $ssl_keystorefile,
ssl_params => $ssl_params,

java_home => $java_home,
java_opts => $java_opts,
host_name => $host_name,
host_autodeploy => $host_autodeploy
}

file { 'default ssl keystore':
ensure => present,
replace => 'no',
owner => 'tomcat',
group => 'tomcat',
path => "/etc/pki/java/keystore.jks",
source => "puppet:///modules/tomcat/conf/.keystore",
mode => '0644'
}
}

node default {
include profiles::tomcat
}
2 changes: 1 addition & 1 deletion modules/puppetforge/tomcat/manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@
database => 'main UserDatabase',
username => $::tomcat::admin_user,
password => $::tomcat::admin_password,
roles => ['manager-gui', 'manager-script', 'admin-gui', 'admin-script']
roles => ['manager-gui', 'manager-script', 'admin-gui', 'admin-script', 'manager']
}
}
}

0 comments on commit 2831e42

Please sign in to comment.