- Overview
- Module Description - What the module does and why it is useful
- Setup - The basics of getting started with tomcat
- Usage - Configuration options and additional functionality
- Reference - An under-the-hood peek at what the module is doing and how
- Classes
- Defined types
- Parameters
- tomcat
- tomcat::config::properties::property
- tomcat::config::server
- tomcat::config::server::connector
- tomcat::config::server::context
- tomcat::config::server::engine
- tomcat::config::server::globalnamingresource
- tomcat::config::server::host
- tomcat::config::server::listener
- tomcat::config::server::realm
- tomcat::config::server::service
- tomcat::config::server::tomcat_users
- tomcat::config::server::valve
- tomcat::config::context
- tomcat::config::context::environment
- tomcat::config::context::manager
- tomcat::config::context::resource
- tomcat::config::context::resourcelink
- tomcat::config::context::valve
- tomcat::install
- tomcat::instance
- tomcat::service
- tomcat::setenv::entry
- tomcat::war
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
The tomcat module lets you use Puppet to install, deploy, and configure Tomcat web services.
Tomcat is a Java web service provider. The tomcat module lets you use Puppet to install Tomcat, manage its configuration file, and deploy web apps to it. It supports multiple instances of Tomcat spanning multiple versions.
The tomcat module requires puppetlabs-stdlib version 4.0 or newer. On Puppet Enterprise you must meet this requirement before installing the module. To update stdlib, run:
puppet module upgrade puppetlabs-stdlib
The simplest way to get Tomcat up and running with the tomcat module is to install the Tomcat source and start the service:
tomcat::install { '/opt/tomcat':
source_url => 'https://www-us.apache.org/dist/tomcat/tomcat-7/v7.0.x/bin/apache-tomcat-7.0.x.tar.gz',
}
tomcat::instance { 'default':
catalina_home => '/opt/tomcat',
}
Note: look up the correct version you want to install on the version list.
class { 'java': }
tomcat::install { '/opt/tomcat9':
source_url => 'https://www.apache.org/dist/tomcat/tomcat-9/v9.0.x/bin/apache-tomcat-9.0.x.tar.gz'
}
tomcat::instance { 'tomcat9-first':
catalina_home => '/opt/tomcat9',
catalina_base => '/opt/tomcat9/first',
}
tomcat::instance { 'tomcat9-second':
catalina_home => '/opt/tomcat9',
catalina_base => '/opt/tomcat9/second',
}
# Change the default port of the second instance server and HTTP connector
tomcat::config::server { 'tomcat9-second':
catalina_base => '/opt/tomcat9/second',
port => '8006',
}
tomcat::config::server::connector { 'tomcat9-second-http':
catalina_base => '/opt/tomcat9/second',
port => '8081',
protocol => 'HTTP/1.1',
additional_attributes => {
'redirectPort' => '8443'
},
}
tomcat::install { '/opt/tomcat7':
source_url => 'http://www-eu.apache.org/dist/tomcat/tomcat-7/v7.0.x/bin/apache-tomcat-7.0.x.tar.gz',
}
tomcat::instance { 'tomcat7':
catalina_home => '/opt/tomcat7',
}
# Change tomcat 7's server and HTTP/AJP connectors
tomcat::config::server { 'tomcat7':
catalina_base => '/opt/tomcat7',
port => '8105',
}
tomcat::config::server::connector { 'tomcat7-http':
catalina_base => '/opt/tomcat7',
port => '8180',
protocol => 'HTTP/1.1',
additional_attributes => {
'redirectPort' => '8543'
},
}
tomcat::config::server::connector { 'tomcat7-ajp':
catalina_base => '/opt/tomcat7',
port => '8109',
protocol => 'AJP/1.3',
additional_attributes => {
'redirectPort' => '8543'
},
}
Note: look up the correct version you want to install on the version list.
file { $keystore_path:
ensure => present,
source => $keystore_source,
owner => $keystore_user,
mode => '0400',
checksum => 'md5',
checksum_value => $keystore_checksum,
} ->
tomcat::config::server::connector { "${tomcat_instance}-https":
catalina_base => $catalina_base,
port => $https_port,
protocol => $http_version,
purge_connectors => true,
additional_attributes => {
'SSLEnabled' => bool2str($https_enabled),
'maxThreads' => $https_connector_max_threads,
'scheme' => $https_connector_scheme,
'secure' => bool2str($https_connector_secure),
'clientAuth' => bool2str($https_connector_client_auth),
'sslProtocol' => $https_connector_ssl_protocol,
'sslEnabledProtocols' => join($https_connector_ssl_protocols_enabled, ","),
'ciphers' => join($ciphers_enabled, ","),
'keystorePass' => $keystore_pass.unwrap,
'keystoreFile' => $keystore_path,
},
}
See also: SSL/TLS Configuration HOW-TO
Add the following to any existing installation with your own war source:
tomcat::war { 'sample.war':
catalina_base => '/opt/tomcat9/first',
war_source => '/opt/tomcat9/webapps/docs/appdev/sample/sample.war',
}
The name of the WAR file must end with .war
.
The war_source
can be a local path or a puppet:///
, http://
, or ftp://
URL.
Different configuration defined types will allow an ensure parameter to be passed, though the name may vary based on the defined type.
To remove a connector, for instance, the following configuration ensure that it is absent:
tomcat::config::server::connector { 'tomcat9-jsvc':
connector_ensure => 'absent',
catalina_base => '/opt/tomcat9/first',
port => '8080',
protocol => 'HTTP/1.1',
}
Describe the Realm or HTTP Connector element using tomcat::config::server::realm
or tomcat::config::server::connector
, and set purge_realms
or purge_connectors
to true
.
tomcat::config::server::realm { 'org.apache.catalina.realm.LockOutRealm':
realm_ensure => 'present',
purge_realms => true,
}
Puppet removes any existing Connectors or Realms and leaves only the ones you've specified.
tomcat
: Main class. Manages some of the defaults for installing and configuring Tomcat.
tomcat::params
: Manages Tomcat parameters.
tomcat::config::properties::property
: Adds a property to catalina.properties filetomcat::config::server
: Configures attributes for the Server element in$CATALINA_BASE/conf/server.xml
.tomcat::config::server::connector
: Configures Connector elements in$CATALINA_BASE/conf/server.xml
.tomcat::config::server::context
: Configures Context elements in$CATALINA_BASE/conf/server.xml
.tomcat::config::server::engine
: Configures Engine elements in$CATALINA_BASE/conf/server.xml
.tomcat::config::server::globalnamingresource
: Configures Global Resource elementstomcat::config::server::host
: Configures Host elements in$CATALINA_BASE/conf/server.xml
.tomcat::config::server::listener
: Configures Listener elements in$CATALINA_BASE/conf/server.xml
.tomcat::config::server::realm
: Configures Realm elements in$CATALINA_BASE/conf/server.xml
.tomcat::config::server::service
: Configures a Service element element nested in theServer
element in$CATALINA_BASE/conf/server.xml
.tomcat::config::server::tomcat_users
: Configures user and role elements for [UserDatabaseRealm] (http://tomcat.apache.org/tomcat-8.0-doc/realm-howto.html#UserDatabaseRealm) or [MemoryRealm] (http://tomcat.apache.org/tomcat-8.0-doc/realm-howto.html#MemoryRealm) in$CATALINA_BASE/conf/tomcat-users.xml
or any other specified file.tomcat::config::server::valve
: Configures a Valve element in$CATALINA_BASE/conf/server.xml
.tomcat::config::context
: Configures a Context element in$CATALINA_BASE/conf/context.xml
.tomcat::config::context::manager
: Configures a Manager element in$CATALINA_BASE/conf/context.xml
.tomcat::config::context::environment
: Configures a Environment element in$CATALINA_BASE/conf/context.xml
.tomcat::config::context::resource
: Configures a Resource element in$CATALINA_BASE/conf/context.xml
.tomcat::config::context::resourcelink
: Configures a ResourceLink element in$CATALINA_BASE/conf/context.xml
.tomcat::config::context::valve
: Configures a Valve element in$CATALINA_BASE/conf/context.xml
.tomcat::install
: Installs a Tomcat instance.tomcat::instance
: Configures a Tomcat instance.tomcat::service
: Provides Tomcat service management.tomcat::setenv::entry
: Adds an entry to a Tomcat configuration file (for example,setenv.sh
or/etc/sysconfig/tomcat
).tomcat::war
: Manages the deployment of WAR files.
tomcat::install::package
: Installs Tomcat from a package.tomcat::install::source
: Installs Tomcat from source.tomcat::instance::copy_from_home
: Copies required files from installation to instancetomcat::instance::dependencies
: Declares puppet dependency chain for an instance.tomcat::config::properties
: Creates instance catalina.properties
All parameters are optional except where otherwise noted.
The base class sets defaults used by other defined types, such as tomcat::install
and tomcat::instance
, such as a default catalina_home
.
Specifies the default root directory of the Tomcat installation.
Valid options: a string containing an absolute path.
Default value: '/opt/apache-tomcat'.
Specifies a default group to run Tomcat as.
Valid options: a string containing a valid group name.
Default value: 'tomcat'.
Determines whether defined types should default to creating the specified group, if it doesn't exist. Uses Puppet's native group
resource type with default parameters.
Valid options: Boolean.
Default value: true
.
Determines whether defined types should default to creating the specified user, if it doesn't exist. Uses Puppet's native user
resource type with default parameters.
Valid options: Boolean.
Default value: true
.
Specifies the default value of manage_base
for all tomcat::install
instances.
Default value: true
.
Specifies the default value of manage_home
for all tomcat::instance
instances.
Default value: true
.
Specifies the default value of manage_properties
for all tomcat::instance
instances.
Default value: true
.
Specifies whether to purge any unmanaged Connector elements that match defined protocol but have a different port from the configuration file by default.
Valid options: Boolean.
Default value: false
.
Specifies whether to purge any unmanaged realm elements from the configuration file by default.
Valid options: Boolean.
Default value: false
. If two realms are defined for a specific server config only use purge_realms
for the first realm and ensure the realms enforce a strict order between each other.
Specifies a default user to run Tomcat as.
Valid options: a string containing a valid username.
Default value: 'tomcat'.
Specifies an additional entry for the catalina.properties file a given catalina base.
The name of the property.
Default value: $name
.
The catalina base of the catalina.properties file. The resource will manage the values in ${catalina_base}/conf/catalina.properties
.
Required
The value of the property.
Required
Specifies a TCP/IP address on which to listen for the shutdown command. Maps to the address XML attribute.
Valid options: a string.
Default value: undef
.
Specifies whether the address XML attribute should exist in the configuration file.
Valid options: 'present', 'absent'.
Default value: 'present'.
Specifies the base directory of the Tomcat installation to manage.
Valid options: a string containing an absolute path.
Default value: '$tomcat::catalina_home'.
Specifies the Java class name of a server implementation to use. Maps to the className XML attribute in the configuration file.
Valid options: a string containing a Java class name.
Default value: undef
.
Specifies whether the className XML attribute should exist in the configuration file.
Valid options: 'present', 'absent'.
Default value: 'present'.
Specifies a port on which to listen for the designated shutdown command. Maps to the port XML attribute.
Valid options: a string containing a port number.
Default value: undef
.
Specifies a server.xml file to manage.
Valid options: a string containing an absolute path.
Default value: '${catalina_base}/config/server.xml'.
Designates a command that shuts down Tomcat when the command is received through the specified address and port. Maps to the shutdown XML attribute.
Valid options: a string.
Default value: undef
.
Specifies any further attributes to add to the Connector.
Valid options: a hash of '< attribute >' => '< value >' pairs.
Default value: {}
.
Specifies an array of attributes to remove from the element.
Valid options: an array of strings.
Default value: []
.
Specifies the base directory of the Tomcat installation to manage.
Valid options: a string containing an absolute path.
Default value: '$::tomcat/catalina_home'.
Specifies whether the Connector XML element should exist in the configuration file.
Valid options: 'present', 'absent'.
Default value: 'present'.
Specifies which Service element the Connector should nest under.
Valid options: a string containing the name attribute of the Service.
Default value: 'Catalina'.
Required if connector_ensure
is set to true
or 'present'. Sets a TCP port on which to create a server socket. Maps to the port XML attribute.
Valid options: a string.
Specifies a protocol to use for handling incoming traffic. Maps to the protocol XML attribute.
Valid options: a string.
Default value: $name
.
Specifies whether to purge any unmanaged Connector elements that match defined protocol but have a different port from the configuration file.
Valid options: Boolean.
Default value: false
.
Specifies a server.xml file to manage.
Valid options: a string containing an absolute path.
Default value: '${catalina_base}/config/server.xml'.
Specifies any further attributes to add to the Context.
Valid options: a hash of '< attribute >' => '< value >' pairs.
Default value: {}
.
Specifies an array of attributes to remove from the element.
Valid options: an array of strings.
Default value: []
.
Specifies the base directory of the Tomcat installation to manage.
Valid options: a string containing an absolute path.
Default value: '$::tomcat/catalina_home'.
Specifies whether the Context XML element should exist in the configuration file.
Valid options: 'present', 'absent'.
Default value: 'present'.
Specifies a Document Base (or Context Root) directory or archive file. Maps to the docBase XML attribute.
Valid options: a string containing a path (either an absolute path or a path relative to the appBase directory of the owning Host).
Default value: $name
.
Specifies which Engine element the Context should nest under. Only valid if parent_host
is specified.
Valid options: a string containing the name attribute of the Engine.
Default value: undef
.
Specifies which Host element the Context should nest under.
Valid options: a string containing the name attribute of the Host.
Default value: undef
.
Specifies which Service XML element the Context should nest under.
Valid options: a string containing the name attribute of the Service.
Default value: 'Catalina'.
Specifies a server.xml file to manage.
Valid options: a string containing an absolute path.
Default value: '${catalina_base}/config/server.xml'.
Determines the delay between invoking the backgroundProcess method on this engine and its child containers. Maps to the backgroundProcessorDelay XML attribute.
Valid options: an integer, in seconds.
Default value: undef
.
Specifies whether the backgroundProcessorDelay XML attribute should exist in the configuration file.
Valid options: 'present', 'absent'.
Default value: 'present'.
Specifies the base directory of the Tomcat installation to manage.
Valid options: a string containing an absolute path.
Default value: '$::tomcat::catalina_home'.
Specifies the Java class name of a server implementation to use. Maps to the className XML attribute.
Valid options: a string containing a Java class name.
Default value: undef
.
Specifies whether the className XML attribute should exist in the configuration file.
Valid options: 'present', 'absent'.
Default value: 'present'.
Required. Specifies a host to handle any requests directed to hostnames that exist on the server but are not defined in this configuration file. Maps to the defaultHost XML attribute of the Engine.
Valid options: a string containing a hostname.
Specifies the logical name of the Engine, used in log and error messages. Maps to the name XML attribute.
Valid options: a string.
Default value: the name
passed in your defined type.
Specifies an identifier to enable session affinity in load balancing. Maps to the jvmRoute XML attribute.
Valid options: string.
Default value: undef
.
Specifies whether the jvmRoute XML attribute should exist in the configuration file.
Valid options: 'present', 'absent'.
Default value: 'present'.
Specifies which Service element the Engine should nest under.
Valid options: a string containing the name attribute of the Service.
Default value: 'Catalina'.
Specifies a server.xml file to manage.
Valid options: a string containing an absolute path.
Default value: '${catalina_base}/config/server.xml'.
Sets how many threads the Engine should use to start child Host elements in parallel. Maps to the startStopThreads XML attribute.
Valid options: a string.
Default value: undef
.
Specifies whether the startStopThreads XML attribute should exist in the configuration file.
Valid options: 'present', 'absent'.
Default value: 'present'.
Configure GlobalNamingResources Resource elements in '$CATALINA_BASE/conf/server.xml'
Determines whether the specified XML element should exist in the configuration file.
Valid options: 'present', 'absent'.
Default value: 'present'.
Optionally override the globalnamingresource name that is normally taken from the Puppet resource's $name
.
Specifies the base directory of the Tomcat instance.
Valid options: a string containing an absolute path.
Default value: '$::tomcat::catalina_home'.
Specifies the type of element to create
Valid options: Resource
, Environment
or any other valid node.
Default value: Resource
.
Note: This is used verbatim in your configuration so make sure the case is correct.
Specifies any further attributes to add to the Host.
Valid options: a hash of '< attribute >' => '< value >' pairs.
Default value: {}
.
Specifies an array of attributes to remove from the element.
Valid options: an array of strings.
Default value: []
.
Specifies a server.xml file to manage.
Valid options: a string containing an absolute path.
Default value: '${catalina_base}/config/server.xml'.
Specifies any further attributes to add to the Host.
Valid options: a hash of '< attribute >' => '< value >' pairs.
Default value: {}
.
Optional array that specifies the list of Host Name Aliases for this particular Host. If omitted, any currently-defined Aliases will not be altered. If present, the list Aliases will be set to exactly match the contents of this array. Thus, for example, an empty array can be used to explicitly force there to be no Aliases for the Host.
Required unless host_ensure
is set to false
or 'absent'. Specifies the Application Base directory for the virtual host. Maps to the appBase XML attribute.
Valid options: a string.
Specifies an array of attributes to remove from the element.
Valid options: an array of strings.
Default value: []
.
Specifies the base directory of the Tomcat installation to manage.
Valid options: a string containing an absolute path.
Default value: '$::tomcat::catalina_home'.
Specifies whether the virtual host (the Host XML element) should exist in the configuration file.
Valid options: 'present', 'absent'.
Default value: 'present'.
Specifies the network name of the virtual host, as registered on your DNS server. Maps to the name XML attribute.
Valid options: a string.
Default value: the 'name' passed in your defined type.
Specifies which Service element the Host should nest under.
Valid options: a string containing the name attribute of the Service.
Default value: 'Catalina'.
Specifies a server.xml file to manage.
Valid options: a string containing an absolute path.
Default value: '${catalina_base}/config/server.xml'.
Specifies any further attributes to add to the Listener.
Valid options: a hash of '< attribute >' => '< value >' pairs.
Default value: {}
.
Specifies an array of attributes to remove from the element.
Valid options: an array of strings.
Default value: []
.
Specifies the base directory of the Tomcat installation.
Valid options: a string containing an absolute path.
Default value: '$::tomcat::catalina_home'.
Specifies the Java class name of a server implementation to use. Maps to the className XML attribute of a Listener Element.
Valid options: a string containing a Java class name.
Default value: $name
.
Specifies whether the Listener XML element should exist in the configuration file.
Valid options: 'present', 'absent'.
Default value: 'present'.
Specifies which Engine element this Listener should nest under.
Valid options: a string containing the name attribute of the Engine.
Default value: undef
.
Specifies which Host element this Listener should nest under.
Valid options: a string containing the name attribute of the Host.
Default value: undef
.
Specifies which Service element the Listener should nest under. Only valid if parent_engine
or parent_host
is specified.
Valid options: a string containing the name attribute of the Service.
Default value: 'Catalina'.
Specifies a server.xml file to manage.
Valid options: a string containing an absolute path.
Default value: '${catalina_base}/config/server.xml'.
Specifies any further attributes to add to the Realm element.
Valid options: a hash of '< attribute >' => '< value >' pairs.
Default value: {}
.
Specifies an array of attributes to remove from the element.
Valid options: an array of strings.
Default value: []
.
Specifies the base directory of the Tomcat installation.
Default value: '$::tomcat::catalina_home'.
Specifies the Java class name of a Realm implementation to use. Maps to the className XML attribute.
Valid options: a string containing a Java class name.
Default value: the name
passed in your defined type.
Specifies which Engine element this Realm should nest under.
Valid options: a string containing the name attribute of the Engine.
Default value: 'Catalina'.
Specifies which Host element this Realm should nest under.
Valid options: a string containing the name attribute of the Host.
Default value: undef
.
Specifies which Realm element this Realm should nest under.
Valid options: a string containing the className attribute of the Realm element.
Default value: undef
.
Specifies which Service element this Realm element should nest under.
Valid options: a string containing the name attribute of the Service.
Default value: 'Catalina'.
Specifies whether to purge any unmanaged Realm elements from the configuration file.
Valid options: Boolean.
Default value: false
.
Specifies whether the Realm element should exist in the configuration file.
Valid options: 'present', 'absent'.
Default value: 'present'.
Specifies a server.xml file to manage.
Valid options: a string containing an absolute path.
Default value: '${catalina_base}/config/server.xml'.
Specifies the base directory of the Tomcat installation.
Valid options: a string containing an absolute path.
Default value: '$::tomcat::catalina_home'.
Specifies the Java class name of a server implementation to use. Maps to the className XML attribute.
Valid options: a string containing a Java class name.
Default value: undef
.
Specifies whether the className XML attribute should exist in the configuration file.
Valid options: 'present', 'absent'.
Default value: 'present'.
Specifies a server.xml file to manage.
Valid options: a string containing an absolute path.
Default value: '${catalina_base}/config/server.xml'.
Specifies whether the Service element should exist in the configuration file.
Valid options: 'present', 'absent'.
Default value: 'present'.
Specifies the base directory of the Tomcat installation.
Valid options: a string containing an absolute path.
Default value: '$::tomcat::catalina_home'.
Specifies the type of element to manage.
Valid options: 'user' or 'role'.
Default value: user
.
Sets the element's username (or rolename, if element
is set to 'role').
Valid options: a string.
Default value: $name
.
Determines whether the specified XML element should exist in the configuration file.
Valid options: 'present', 'absent'.
Default value: 'present'.
Specifies the configuration file to manage.
Valid options: a string containing a fully-qualified path.
Default value: '$CATALINA_BASE/conf/tomcat-users.xml'.
Specifies the group of the configuration file.
Default value: $::tomcat::group
.
Specifies whether to create the specified configuration file if it doesn't exist. Uses Puppet's native file
resource type with default parameters.
Valid options: Boolean.
Default value: true
.
Specifies the owner of the configuration file.
Default value: $::tomcat::user
.
Specifies a password for user elements.
Valid options: a string.
Default value: undef
.
Specifies one or more roles. Only valid if element
is set to 'role' or 'user'.
Valid options: an array of strings.
Default value: []
.
Specifies any further attributes to add to the Valve.
Valid options: a hash of '< attribute >' => '< value >' pairs.
Default value: {}
.
Specifies an array of attributes to remove from the element.
Valid options: an array of strings.
Default value: []
.
Specifies the base directory of the Tomcat installation.
Valid options: a string containing an absolute path.
Default value: $::tomcat::catalina_home
.
Specifies the Java class name of a server implementation to use. Maps to the className XML attribute.
Valid options: a string containing a Java class name.
Default value: the 'name' passed in your defined type.
Specifies which virtual host the Valve should nest under.
Valid options: a string containing the name of a Host element.
Default value: If you don't specify a host, the Valve element nests under the Engine of your specified parent Service.
Specifies which Service element the Valve should nest under.
Valid options: a string containing the name of a Service element.
Default value: 'Catalina'.
Specifies which Context element the Valve should nest under.
Valid options: a string containing the name of a Context element (matching the docbase attribute).
Default value: If you don't specify a context, the Valve element nests under either the Parent Host if defined or the Engine of your specified parent Service.
Specifies a server.xml file to manage.
Valid options: a string containing an absolute path.
Default value: '${catalina_base}/config/server.xml'.
Specifies whether the Valve should exist in the configuration file. Maps to the Valve XML element.
Valid options: 'present', 'absent'.
Default value: 'present'.
Specifies a configuration Context element in ${catalina_base}/conf/context.xml
for other tomcat::config::context::*
defined types.
Specifies the root of the Tomcat installation.
Specifies a Manager element in the designated xml configuration.
specifies whether you are trying to add or remove the Manager element.
Valid options: 'present', 'absent'.
Default value: 'present'.
Specifies the root of the Tomcat installation.
Default value: '$tomcat::catalina_home'.
The name of the Manager to be created.
Default value: $name
.
Specifies any additional attributes to add to the Manager.
Should be a hash of the format 'attribute' => 'value'.
Optional
Specifies an array of attributes to remove from the element.
Valid options: an array of strings.
Default value: []
.
Specifies Environment elements in ${catalina_base}/conf/context.xml
Specifies whether you are trying to add or remove the Environment element
Valid options: 'present', 'absent'.
Default value: 'present'.
The name of the Environment Entry to be created, relative to the java:comp/env
context.
Default value: $name
.
The fully qualified Java class name expected by the web application for this environment entry.
Required to create the environment entry.
The value that will be presented to the application when requested from the JNDI context.
Required to create the environment entry.
The description is an an optional string for a human-readable description of this environment entry.
An optional string or Boolean to specify if you do not want an <env-entry>
for the same environment entry name to override the value specified here (set it to false
).
By default, overrides are allowed.
Specifies the root of the Tomcat installation.
Default value: '$tomcat::catalina_home'.
Specifies any additional attributes to add to the Environment.
Should be a hash of the format 'attribute' => 'value'.
Optional
Specifies an array of attributes to remove from the element.
Valid options: an array of strings.
Default value: []
.
Specifies Resource elements in ${catalina_base}/conf/context.xml
Specifies whether you are trying to add or remove the Resource element.
Valid options: 'present', 'absent'.
Defaults value: 'present'
The name of the Resource to be created, relative to the java:comp/env
context.
Default value: $name
.
The fully qualified Java class name expected by the web application when it performs a lookup for this resource. Required to create the resource.
Specifies the root of the Tomcat installation.
Default value: '$tomcat::catalina_home'.
Specifies any additional attributes to add to the Valve.
Should be a hash of the format 'attribute' => 'value'.
Optional
Specifies an array of attributes to remove from the element.
Valid options: an array of strings.
Default value: []
.
Specifies Valve elements in ${catalina_base}/conf/context.xml
Specifies whether you are trying to add or remove the Valve element.
Valid values are 'present', 'absent'.
Defaults to 'present'
The name of the Resource to be created, relative to the java:comp/env context.
Default: $name
The fully qualified Java class name expected by the web application when it performs a lookup for this resource. Required to create the resource.
Specifies the root of the Tomcat installation.
Default: $tomcat::catalina_home
Specifies any further attributes to add to the Valve.
Valid options: a hash of '< attribute >' => '< value >' pairs.
Default value: {}
.
Specifies an array of attributes to remove from the element.
Valid options: an array of strings.
Default value: []
.
Specifies a ResourceLink element in the designated xml configuration.
specifies whether you are trying to add or remove the ResourceLink element.
Valid options: 'present', 'absent'.
Default value: 'present'.
Specifies the root of the Tomcat installation.
Default value: $tomcat::catalina_home
.
The name of the ResourceLink to be created, relative to the java:comp/env
context.
Default value: $name
.
The fully qualified Java class name expected by the web application when it performs a lookup for this resource link.
Specifies any additional attributes to add to the Valve.
Should be a hash of the format 'attribute' => 'value'.
Optional
Specifies an array of attributes to remove from the element.
Valid options: an array of strings.
Default value: []
.
Installs the software into the given directory from a source Apache Tomcat tarball. Alternatively, it may be used to install a tomcat package.
Tomcat instances may then be created from the install using tomcat::instance
and pointing tomcat::instance::catalina_home
to the directory managed by tomcat::install
.
specifies the directory of the Tomcat installation from which the instance should be created.
Valid options: a string containing an absolute path.
Default value: '$::tomcat::catalina_home'.
Specifies whether to install from source or from a package. If set to true
installation uses the source_url
, source_strip_first_dir
, user
, group
, manage_user
, and manage_group
parameters. If set to false
installation uses the package_ensure
, package_name
, and package_options
parameters.
Valid options: Boolean.
Default value: true
.
In single-instance mode: Required if install_from_source
is set to true
. Specifies the source URL to install from.
Valid options: a string containing a puppet://
, http(s)://
, or ftp://
URL.
Specifies whether to strip the topmost directory of the tarball when unpacking it. Only valid if install_from_source
is set to true
.
Valid options: Boolean.
Default value: true
.
Specifies a proxy server to use when downloading Tomcat binaries. For example, 'https://example.com:8080'.
Default value: undef
.
Specifies the proxy server type used by proxy_server
. Normally this defaults to the protocol specified in the proxy_server
URI.
Default value: auto-detected from proxy_server
.
Valid options: 'none', 'http', 'https', 'ftp'.
Specifies if HTTPS errors should be ignored when downloading the source tarball.
Default value: false
.
Valid options: Boolean.
Specifies the owner of the source installation directory.
Default value: $::tomcat::user
.
Specifies the group of the source installation directory.
Default value: $::tomcat::group
.
Specifies whether the user should be managed by this module or not.
Default value: $::tomcat::manage_user
.
Specifies whether the group should be managed by this module or not.
Default value: $::tomcat::manage_group
.
Specifies whether the directory of catalina_home should be managed by puppet. This may not be preferable in network filesystem environments.
Default value: true
.
Determines whether the specified package should be installed. Only valid if install_from_source
is set to false
. Maps to the ensure
parameter of Puppet's native package
resource type.
Default value: 'present'.
Required if install_from_source
is set to false
. Specifies the package to install.
Valid options: a string containing a valid package name.
Unused if install_from_source
is set to true
. Specify additional options to use on the generated package resource. See the documentation of the package
resource type for possible values.
Declares a tomcat instance.
There are two different modes of use: a single tomcat installation and instance (called 'single-instance' by this readme), or a single tomcat installation with multiple instances, each with its own directory structure (called 'multi-instance' by this readme).
- single-instance: If a
tomcat::instance
is declared withcatalina_home
andcatalina_base
both pointing to the directory of atomcat::install
then it only configures a single instance. - multi-instance: If a
tomcat::instance
is declared withcatalina_home
pointing to the same directory as atomcat::install
andcatalina_base
pointing at a different directory then it is configured as an instance of the Apache Tomcat software. Multiple instances of a single install may be created using this method. Atomcat::install
declaration should use a user and/or group such thattomcat::instance
declarations can access the install.
Specifies the $CATALINA_BASE
of the Tomcat instance where logs, configuration files, and the 'webapps' directory are managed. For single-instance installs, this is the same as the catalina_home
parameter
Valid options: a string containing an absolute path.
Default value: $catalina_home
.
Specifies the directory where the Apache Tomcat software is installed by a tomcat::install
resource.
Valid options: a string containing an absolute path.
Default value: '$::tomcat::catalina_home'.
Specifies the subdirectories under catalina_base
to be managed for an instance (disabled via manage_dirs
Boolean).
Valid options: an array of strings, each being a relative subdirectory to catalina_base
.
Default value: ['bin','conf','lib','logs','temp','webapps','work']
.
Specifies a mode for the managed subdirectories under catalina_base
for an instance (as specified in dir_list
and disabled via manage_dirs
Boolean).
Valid option: a string containing a standard Linux mode.
Default value: '2770'.
Specifies the full path of config files to copy from catalina_home
to catalina_base
for an instance (disabled via manage_copy_from_home
Boolean).
Valid options: array of strings containing path + filename.
Default value: [ '${_catalina_base}/conf/catalina.policy', '${_catalina_base}/conf/context.xml', '${_catalina_base}/conf/logging.properties', '${_catalina_base}/conf/server.xml', '${_catalina_base}/conf/web.xml', ]
Specifies the file mode when copying the initial config files from catalina_home
to catalina_base
.
Valid options: a string containing a standard Linux mode.
Default value: '0660'.
Specifies the group of the instance directories and files.
Default value: $::tomcat::group
.
Specifies the java home to be used when declaring a tomcat::service
instance. See [tomcat::service](# tomcatservice)
Specifies whether the directory of catalina_base should be managed by Puppet. This might not be preferable in network filesystem environments.
Default value: true
.
Determines whether subdirectories for catalina_base
should be managed as part of tomcat::instance. The default directories are listed in dir_list
.
Valid options: Boolean.
Specifies whether to copy the initial config files from catalina_home
to catalina_base
.
Valid options: Boolean.
Default value: true
.
Specifies whether the group should be managed by this module or not.
Default value: $::tomcat::manage_group
.
Specifies whether the catalina.properties
file is created and managed. If true
, custom modifications to this file will be overwritten during runs
Valid options: Boolean
Default value: true
.
Specifies whether a tomcat::service
corresponding to this instance should be declared.
Valid options: Boolean
Default value: true
(multi-instance installs), false
()single-instance installs).
Specifies whether the user should be managed by this module or not.
Default value: $::tomcat::manage_user
.
Specifies whether an init script should be managed when declaring a tomcat::service
instance. See [tomcat::service](# tomcatservice)
Specifies whether jsvc should be used when declaring a tomcat::service
instance.
Note that this module will not compile and install jsvc for you. See [tomcat::service](# tomcatservice)
Specifies the owner of the instance directories and files.
Default value: $::tomcat::user
.
Specifies the base directory of the Tomcat installation.
Valid options: a string containing an absolute path.
Default value: '$::tomcat::catalina_home'.
Specifies the root directory of the Tomcat installation.
Valid options: a string containing an absolute path.
Default value: '$::tomcat::catalina_home'.
Specifies where Java is installed. Only applies if use_jsvc
is set to true
.
Valid options: a string containing an absolute path.
Default value: undef
.
Note: If you don't specify a home path in this parameter, Puppet does not pass the
-home
switch to Tomcat. That can cause problems on some systems, so we recommend including this parameter.
Specifies whether to enable the Tomcat service at boot. Only valid if use_init
is set to true
.
Valid options: Boolean.
Default value: true
, if use_init
is set to true
and service_ensure
is set to 'running' or true
.
Specifies whether the Tomcat service should be running. Maps to the ensure
parameter of Puppet's native service
resource type.
Valid options: 'running', 'stopped', true
, false
.
Default value: 'present'.
Required if use_init
is set to true
. Specifies the name of the Tomcat service.
Valid options: a string.
Designates a command to start the service.
Valid options: a string.
Default value: determined by the values of use_init
and use_jsvc
.
Designates a command to get the status of the service.
Valid options: a string.
Default value: determined by the values of use_init
and use_jsvc
.
Designates a command to stop the service.
Valid options: a string.
Default value: determined by the values of use_init
and use_jsvc
.
Specifies whether to use a package-provided init script for service management.
$CATALINA_HOME/bin/catalina.sh start
$CATALINA_HOME/bin/catalina.sh stop
Valid options: Boolean.
Default value: false
.
Note that the tomcat module does not supply an init script. If both
use_jsvc
anduse_init
are set tofalse
, tomcat uses the following commands for service management:
Specifies whether to use Jsvc for service management. If both use_jsvc
and use_init
are set to false
, tomcat uses the following commands for service management:
$CATALINA_HOME/bin/catalina.sh start
$CATALINA_HOME/bin/catalina.sh stop
Valid options: Boolean.
Default value: false
.
The user of the jsvc process when use_init => true
Specifies the configuration file to edit.
Valid options: a string containing an absolute path.
Default value: '$::tomcat::catalina_home/bin/setenv.sh.
Determines whether the fragment should exist in the configuration file.
Valid options: 'present', 'absent'.
Default value: 'present'.
Specifies the group of the config file.
Default value: $::tomcat::group
.
Determines the ordering of your parameters in the configuration file (parameters with lower order
values appear first.)
Valid options: an integer or a string containing an integer.
Default value: 10
.
Defines an additional environment variable that will be added to the beginning of the param
Specifies a parameter to manage.
Valid options: a string.
Default value: the name
passed in your defined type.
Specifies a character to include before and after the specified value.
Valid options: a string (usually a single or double quote).
Default value: (blank).
Specifies the owner of the config file.
Default value: $::tomcat::user
.
Required. Provides the value(s) of the managed parameter.
Valid options: a string or an array. If passing an array, separate values with a single space.
Specifies if you want to append export to the entry.
Valid options: Boolean
Default value: true
.
Specifies if HTTPS errors should be ignored when downloading the war tarball.
Default value: false
,
Valid options: Boolean.
Specifies where to deploy the WAR. Cannot be used in combination with deployment_path
.
Valid options: a string containing a path relative to $CATALINA_BASE
.
Default value: If you don't specify an app_base
, Puppet deploys the WAR to your specified deployment_path
. If you don't specify that either, the WAR deploys to ${catalina_base}/webapps
.
Specifies the base directory of the Tomcat installation.
Valid options: a string containing an absolute path.
Default value: $::tomcat::catalina_home
.
Specifies where to deploy the WAR. Cannot be used in combination with app_base
.
Valid options: a string containing an absolute path.
Default value: If you don't specify a deployment_path
, Puppet deploys the WAR to your specified app_base
. If you don't specify that either, the WAR deploys to ${catalina_base}/webapps
.
Specifies whether the WAR should exist.
Valid options: 'present', 'absent'.
Default value: 'present'.
Specifies the name of the WAR.
Valid options: a string containing a filename that ends in '.war'.
Default value: the name
passed in your defined type.
Specifies whether to purge the exploded WAR directory. Only applicable when war_ensure
is set to 'absent' or false
.
Valid options: Boolean.
Default value: true
.
Note: Setting this parameter to
false
does not prevent Tomcat from removing the exploded WAR directory if Tomcat is running and autoDeploy is set totrue
.
Required unless war_ensure
is set to false
or 'absent'. Specifies the source to deploy the WAR from.
Valid options: a string containing a puppet://
, http(s)://
, or ftp://
URL.
The 'owner' of the tomcat war file.
Default value: 'tomcat'.
The 'group' owner of the tomcat war file.
Default value: 'tomcat'.
This module only supports Tomcat installations on Unix-like systems. The tomcat::config::server*
defined types require Augeas version 1.0.0 or newer.
Some Tomcat packages do not let you install more than one instance. You can avoid this limitation by installing Tomcat from source.
Puppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can't access the huge number of platforms and myriad of hardware, software, and deployment configurations that Puppet is intended to serve.
We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.
For more information, see our module contribution guide.
To see who's already involved, see the list of contributors.
This project contains tests for both rspec-puppet and beaker-rspec to verify functionality. For in-depth information, please see their respective documentation.
Quickstart:
gem install bundler
bundle install
bundle exec rake spec
bundle exec rspec spec/acceptance
RS_DEBUG=yes bundle exec rspec spec/acceptance