Version information
This version is compatible with:
- Puppet Enterprise 2023.8.x, 2023.7.x, 2023.6.x, 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x
- Puppet >= 7.0.0 < 9.0.0
- , , ,
Start using this module
Add this module to your Puppetfile:
mod 'jonnyhoeven-activemq', '2.0.1'
Learn more about managing modules with a PuppetfileDocumentation
puppet-activemq
Table of Contents
Overview
A puppet module to install and configure ActiveMQ Artemis.
PLEASE NOTE: Legacy ActiveMQ is NOT supported by this module.
Requirements
A working Java installation is required (puppetlabs-java is highly recommended). The module is designed for Hiera, so there may be some rough edges when used without Hiera.
Usage
Basic usage
The minimum configuration should at least specify the admin password, the desired version and the checksum of the distribution archive (bin.tar.gz). The checksum is available from ActiveMQ's download page.
class { 'java': }
class { 'activemq':
admin_password => 'seCReT',
admin_user => 'admin',
checksum => 'a73331cb959bb0ba9667414682c279bc9ce2aec4c8fecbcdee4670bf9d63bf66010c8c55a6b727b1ad6d51bbccadd663b96a70b867721d9388d54a9391c6af85',
instances => {'activemq' => {}},
version => '2.23.1',
}
This will install and configure a standalone instance of ActiveMQ Artemis.
Multiple instances
Multiple instances can be setup like this:
$instances = {
'instance1' => {
bind => '127.0.0.1',
port => 61616,
web_port => 8161,
acceptors => {
artemis => { port => 61616 },
amqp => { port => 5672 },
},
},
'instance2' => {
bind => '127.0.0.1',
port => 62616,
web_port => 8261,
acceptors => {
artemis => { port => 62616 },
amqp => { port => 5772 },
},
},
'instance3' => {
bind => '127.0.0.1',
port => 63616,
web_port => 8361,
acceptors => {
artemis => { port => 63616 },
amqp => { port => 5872 },
},
}
}
class { 'java': }
class { 'activemq':
checksum => 'a73331cb959bb0ba9667414682c279bc9ce2aec4c8fecbcdee4670bf9d63bf66010c8c55a6b727b1ad6d51bbccadd663b96a70b867721d9388d54a9391c6af85',
instances => $instances,
version => '2.23.1',
}
Note that you need to modify the port numbers for each instance when running on the same host (as demonstrated in this example), so that they do not try to bind on the same IP:PORT combination.
Instead of using the $instances
parameter, the defined type can also be used directly:
activemq::instance { 'test1':
bind => $facts['networking']['ip'],
port => 61616,
...
}
But contrary to the $instances
parameter, all required parameters have to be provided when using the defined type directly.
Clusters
Complex cluster configurations are also supported. You should provide a complete $cluster_topology
on every node. Use target_host
to let the module automatically setup the instances on the correct servers. For example:
$cluster_topology = {
'node1' => {
target_host => 'server1.example.com',
bind => '10.0.0.1',
group => 'green'
},
'node2' => {
target_host => 'server3.example.com',
bind => '10.0.0.2',
group => 'green',
role => 'slave'
},
'node3' => {
target_host => 'server2.example.com',
bind => '10.0.0.3',
group => 'yellow'
},
'node4' => {
target_host => 'server1.example.com',
bind => '10.0.0.4',
group => 'yellow',
role => 'slave'
},
'node5' => {
target_host => 'server3.example.com',
bind => '10.0.0.5',
group => 'white'
},
'node6' => {
target_host => 'server2.example.com',
bind => '10.0.0.6',
group => 'white',
role => 'slave'
},
}
class { 'java': }
class { 'activemq':
checksum => '84b5a65d8eb2fc8cf3f17df524d586b0c6a2acfa9a09089d5ffdfc1323ff99dfdc775b2e95eec264cfeddc4742839ba9b0f3269351a5c955dd4bbf6d5ec5dfa9',
cluster => true,
cluster_name => 'cluster001',
cluster_password => 'seCReT'
cluster_user => 'clusteradmin'
cluster_topology => $cluster_topology,
instances => $cluster_topology,
server_discovery => 'static',
version => '2.14.0',
}
Note that the parameters $cluster_topology
and $instances
both use the same values. If this configuration is used on host server1.example.com
, then the module ensures that only instances node1
and node4
are installed, all other instances are ignored and will be installed only on the specified target host.
Also note that this examples assumes that each instance is running on it's own IP address. If multiple instances share the same IP address you need to change the port numbers to avoid conflicts (see "Multiple instances").
The $cluster_topology
parameter is also used by the module to setup communication between cluster nodes (depending on your configuration).
Security, Roles, Users and Queues
The instance configuration can be changed by using the required parameter or by modifying $activemq::instance_defaults
(which will apply to all instances). The module data contains pretty verbose examples on how to configure queues, roles and users. Please open a GitHub issue if these examples require further explanation.
Custom configuration
The module should provide a sane default configuration for many use-cases, but overriding these values for all instances is pretty easy:
class { 'activemq':
instance_defaults => {
acceptors => {
artemis => {
enable => false,
},
stomp => {
enable => true,
},
},
acceptor_settings => [
'tcpSendBufferSize=1048576',
],
allow_failback => false,
check_for_live_server => false,
max_hops => 2,
},
}
Please have a look at the examples in the module data to find all supported settings.
The module is designed for Hiera so it is highly recommended if you need to change the default configuration.
Reference
Classes and parameters are documented in REFERENCE.md.
Limitations
Upgrades of ActiveMQ Artemis are supported to a certain degree, provided that the new version is compatible with this module. Please note that in-place upgrades are performed and the official upgrade script is not used. This may have unwanted side-effect. Overall this upgrade procedure should be pretty safe for multi-instance primary/backup setups.
Development
Contributing
Please use the GitHub issues functionality to report any bugs or requests for new features. Feel free to fork and submit pull requests for potential contributions.
All contributions must pass all existing tests, new features should provide additional unit/acceptance tests.
Reference
Table of Contents
Classes
Public Classes
activemq
: Install and configure ActiveMQ Artemis
Private Classes
activemq::install
: Install ActiveMQ distribution archiveactivemq::service
: Setup ActiveMQ multi-instance system service
Defined types
activemq::instance
: Create an instance of ActiveMQ Artemis broker
Classes
activemq
Install and configure ActiveMQ Artemis
Parameters
The following parameters are available in the activemq
class:
admin_password
admin_user
bootstrap_template
broker_template
checksum
checksum_type
cluster
cluster_name
cluster_password
cluster_user
cluster_topology
distribution_name
download_url
gid
group
hawtio_role
install_base
instance_defaults
instances
instances_base
java_args
java_xms
java_xmx
jolokia_access_template
log4j_template
logging_template
login_template
manage_account
manage_instances_base
manage_roles
manage_users
management_template
port
proxy_server
proxy_type
roles_properties_template
server_discovery
service_enable
service_ensure
service_file
service_name
service_template
symlink_name
uid
user
users_properties_template
version
admin_password
Data type: String
Specifies the password to use for standalone instances.
admin_user
Data type: String
Specifies the name of the user to use for standalone instances.
bootstrap_template
Data type: String
The template used to generate bootstrap.xml.
broker_template
Data type: String
The template used to generate broker.xml.
checksum
Data type: Optional[String]
Specifies the checksum for the distribution archive (bin.tar.gz), which will be verified after downloading the file and before starting the installation.
Default value: undef
checksum_type
Data type: Optional[String]
Specifies the type of the checksum. Defaults to sha512
.
Default value: undef
cluster
Data type: Boolean
Whether to setup a cluster or a standalone instance.
cluster_name
Data type: Optional[String]
Specifies the name to use for the cluster.
Default value: undef
cluster_password
Data type: String
Specifies the password to use for clustered instances.
cluster_user
Data type: String
Specifies the name of the user to use for clustered instances.
cluster_topology
Data type: Hash[String[1], Hash]
The topology of the cluster, which should contain ALL instances across the whole cluster (not only local instances), their settings and relationships.
distribution_name
Data type: String
Specifies the name of the distribution, which is usually used to build the actual download URL.
download_url
Data type: String
Specifies the download location. It should contain a %s
string which
is automatically replaced with the actual filename during installation.
The latter makes it easier to use mirror redirection URLs.
gid
Data type: Optional[Integer]
Specifies an optional GID that should be used when creating the group.
Default value: undef
group
Data type: String
Specifies the name of the group to use for the service/instance.
hawtio_role
Data type: String
Access to the JMX web console is only allow to users with this role.
install_base
Data type: Stdlib::Absolutepath
Specifies the installation directory. This directory must already exist. A subdirectory for every version is automatically created.
instance_defaults
Data type: Hash
The default parameters for all instances. They are merged with all instance-specific parameters. This makes it obsolete to specify ALL required parameters for every instance, but only parameters that differ from these defaults.
instances
Data type: Hash[String[1], Hash]
A list of instances that should be created.
instances_base
Data type: Stdlib::Absolutepath
Specifies the directory where broker instances should be installed. This directory must already exist. A subdirectory for every instance is automatically created.
java_args
Data type: Hash
Options for the JVM. Be careful to not override required default options. The syntax may look a bit off, but this way it's possible to replace certain values or to remove an option by adding the value 'DISABLED'.
java_xms
Data type: String
The initial Java heap size.
java_xmx
Data type: String
The maximum Java heap size.
jolokia_access_template
Data type: String
The template used to generate jolokia-access.xml.
log4j_template
Data type: String
The template used to generate log4j2.properties (on version 2.27.0 and later).
logging_template
Data type: String
The template used to generate logging.properties (on versions before 2.27.0).
login_template
Data type: String
The template used to generate login.config.
manage_account
Data type: Boolean
Whether or not to create the user and group.
manage_instances_base
Data type: Boolean
Whether or not to create the directory specified in $instances_base
.
manage_roles
Data type: Boolean
Whether or not to manage ActiveMQ roles.
manage_users
Data type: Boolean
Whether or not to manage ActiveMQ users.
management_template
Data type: String
The template used to generate management.xml.
port
Data type: Integer
Specifies the port to use for the artemis connector and will also be used as default port for the acceptor.
proxy_server
Data type: Optional[String]
Specify a proxy server, with port number if needed. ie: https://example.com:8080
Default value: undef
proxy_type
Data type: Optional[String]
Specify the proxy_type: proxy server type (none|http|https|ftp)
Default value: undef
roles_properties_template
Data type: String
The template used to generate roles.properties.
server_discovery
Data type: Enum['dynamic','static']
Controls how servers can propagate their connection details.
service_enable
Data type: Boolean
Specifies whether the service should be enabled.
service_ensure
Data type: Enum['running','stopped']
Specifies the desired state for the service.
service_file
Data type: Stdlib::Absolutepath
Specifies the filename of the service file.
service_name
Data type: String
Controls the name of the system service. Must NOT be changed while instances are running.
service_template
Data type: String
The template used to generate the service definition.
symlink_name
Data type: String
Controls the name of a version-independent symlink. It will always point
to the release specified by $version
.
uid
Data type: Optional[Integer]
Specifies an optional UID that should be used when creating the user.
Default value: undef
user
Data type: String
Specifies the name of the user to use for the service/instance.
users_properties_template
Data type: String
The template used to generate users.properties.
version
Data type: String
Specifies the version of ActiveMQ (Artemis) to install and use. No default value is provided on purpose, to avoid prevent new users from using a outdated version and to avoid unexpected updates by later changing the default value.
Defined types
activemq::instance
Create an instance of ActiveMQ Artemis broker
Parameters
The following parameters are available in the activemq::instance
defined type:
acceptors
acceptor_settings
address_settings
addresses
allow_failback
allow_direct_connections_only
bind
broadcast_groups
broker_plugins
check_for_live_server
connectors
discovery_groups
failover_on_shutdown
global_max_size_mb
group
ha_policy
initial_replication_sync_timeout
java_args
java_xms
java_xmx
jmx
journal_buffer_timeout
journal_datasync
journal_max_io
journal_type
log_level
log4j_level
management_notification_address
max_disk_usage
max_hops
message_load_balancing
persistence
port
role
security
service_enable
service_ensure
target_host
vote_on_replication_failure
web_bind
web_port
acceptors
Data type: Hash[String[1], Hash]
ActiveMQ Artemis acceptors.
acceptor_settings
Data type: Array
Shared settings that should be used for ALL acceptors.
address_settings
Data type: Hash[String[1], Hash]
A hash containing global address settings. This is especially useful for wildcard/catch all matches.
addresses
Data type: Hash[String[1], Hash]
A hash containing configuration for addresses (messaging endpoints),
queues and routing types. Note: Setting adresses and queues to
enable: false
will remove them from the configuration file, but
they will still be available in Artemis. In order to completely
remove them, the config-delete-*
options may be set to FORCE
.
allow_failback
Data type: Boolean
Should stop backup on live restart.
allow_direct_connections_only
Data type: Optional[Boolean]
When using static
for server_discovery
only make connections to the defined connectors and not any other
broker in the cluser.
Default value: true
bind
Data type: String
Configure which IP address to listen on. Should be either a FQDN or an IP address.
broadcast_groups
Data type: Array
ActiveMQ Artemis broadcast groups.
broker_plugins
Data type: Hash[String[1], Hash]
A hash containing a list of broker plugins and their configuration.
Each plugin can be enabled by setting enable
to true
.
check_for_live_server
Data type: Boolean
Used for a live server to verify if there are other nodes with the same ID on the topology.
connectors
Data type: Hash[String[1], Hash]
ActiveMQ Artemis connectors.
discovery_groups
Data type: Array
ActiveMQ Artemis discovery groups.
failover_on_shutdown
Data type: Boolean
This will cause a HA failover to occur on normal server shutdown.
global_max_size_mb
Data type: Optional[Integer]
The amount in Mb before all addresses are considered full.
Default value: undef
group
Data type: Optional[String]
The group for ActiveMQ Artemis.
Default value: undef
ha_policy
Data type: Optional[Enum['live-only','replication','shared-storage']]
ActiveMQ Artemis HA policy.
initial_replication_sync_timeout
Data type: Integer
Timeout for initial replication to complete.
java_args
Data type: Hash
Options for the JVM. Be careful to not override required default options. The syntax may look a bit off, but this way it's possible to replace certain values or to remove an option by adding the value 'DISABLED'.
Default value: $activemq::java_args
java_xms
Data type: String
The initial Java heap size.
Default value: $activemq::java_xms
java_xmx
Data type: String
The maximum Java heap size.
Default value: $activemq::java_xmx
jmx
Data type: Hash
A hash containing settings for the Jolokia JMX console.
journal_buffer_timeout
Data type: Integer
The flush timeout for the journal buffer.
journal_datasync
Data type: Boolean
Whether ActiveMQ Artemis will use msync/fsync on journal operations.
journal_max_io
Data type: Integer
The maximum number of write requests that can be in the ASYNCIO queue at any one time.
journal_type
Data type: Enum['asyncio','mapped','nio']
The type of journal to use.
log_level
Data type: Hash
The log levels to use for the various configured loggers (on versions before 2.27.0).
log4j_level
Data type: Hash
The log levels to use for the various configured loggers (on version 2.27.0 and later).
management_notification_address
Data type: String
The address to receive management notifications.
max_disk_usage
Data type: Integer
The max percentage of data to use from disks. The broker will block while the disk is full. Disable by setting -1.
max_hops
Data type: Integer
Maximum number of hops cluster topology is propagated.
message_load_balancing
Data type: Enum['off','strict','on_demand']
Specifies how messages should be load balanced.
persistence
Data type: Boolean
Whether the server will use the file based journal for persistence.
port
Data type: Integer
The port to use.
role
Data type: Enum['master','slave']
The replication role.
security
Data type: Hash
A hash containing the security configuration, includes users and roles.
service_enable
Data type: Optional[Boolean]
Specifies whether the service should be enabled for this instance.
Default value: undef
service_ensure
Data type: Optional[Enum['running','stopped']]
Specifies the desired service state for this instance.
Default value: undef
target_host
Data type: Optional[String]
Specifies the target host where this instance should be installed.
The value will be matched against $facts['networking']['fqdn']
.
This is especially useful for cluster configurations.
Default value: undef
vote_on_replication_failure
Data type: Boolean
Configuration for classic replication (not needed for Pluggable Quorum Vote Replication).
web_bind
Data type: String
The host name to use for embedded web server.
web_port
Data type: Integer
The port to use for embedded web server.
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
v2.0.0 - 2023-09-19
This is a new major release which may contain breaking changes for some users, because it may replace existing configuration with new default values.
Added
- Add new parameter
$management_notification_address
- Add support for managing Jolokia allow-origin CORS option
Changed
- Do not produce a HA policy config when
$ha_policy
is empty (#6) - Manage
jolokia-access.xml
, existing file will be replaced - Add defaults for
config-delete-*
to address settings - Set a default management notification address
- Update Puppet version requirements
v1.6.0 - 2023-07-24
Added
- Ensure compatibility with version 2.29.0
- Add new parameter
$log4j_template
- Add new instance parameter
$log4j_level
- Add new default logging config for log4j2
Changed
- Manage
log4j2.properties
on version 2.27.0 and later - Manage
logging properties
only on versions before 2.27.0 - Update to PDK 3.0
- Bump module dependencies
Fixed
- Fix GitHub Actions
- Fix compatibility with puppetlabs/stdlib v9.0.0
v1.5.0 - 2022-10-24
Fixed
- Fix resource not found when disabling user/role management
- Fix service not restarting when changing bootstrap/logging/login config
v1.4.0 - 2022-10-19
Added
- Add new parameters:
$java_args
,$java_xms
,$java_xmx
- Add basic unit/acceptance tests
- Add documentation for all parameters
Changed
- Manage custom JAVA_ARGS in artemis.profile
- Enable allow-failback for all HA policies (not restricted to shared storage anymore)
Fixed
- Fix failed validation when setting
$cluster=false
- Do not try to 'enable' the systemd unit template (fails on recent systemd versions)
v1.3.0 - 2022-07-27
Added
- Add possibility to install behind proxy (#2)
- Ensure compatibility with version 2.21.0 and later
- Add support for updating ActiveMQ Artemis
Changed
- Adopt namespace changes in bootstrap.xml and management.xml (backwards-compatible)
- Set variable ARTEMIS_HOME to symlink location in artemis.profile
- Update OS support, module dependencies and PDK
Fixed
- Fix puppet-lint offenses
v1.2.0 - 2021-09-02
Added
- Add possibility to setup connectors for the Artemis Management API
v1.1.0 - 2021-08-31
Added
- Let Puppet maintain
management.xml
(existing config will be overwritten) - Add new parameter
$hawtio_role
to manage HAWTIO_ROLE in artemis.profile
Changed
- Update to PDK 2.2.0
- Update dependency and Puppet version requirements
v1.0.0 - 2020-10-06
Initial release
Dependencies
- puppetlabs-stdlib (>= 4.25.0 < 10.0.0)
- puppet/archive (>= 4.0.0 < 8.0.0)
Copyright (C) 2020 Frank Wall All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.