ansible-middleware / amq

A collection to manage AMQ brokers
Apache License 2.0
16 stars 12 forks source link

Parameter `activemq_logger_config_template` allows relative paths #116

Closed guidograzioli closed 6 months ago

guidograzioli commented 6 months ago

It is now possible to pass the filename relative to playbook search paths as:

 activemq_logger_config_template: logging/custom.log4j2.properties.j2

This will template the file and copy at the correct destination stripping the directory and the jinja extension (if present). The original basename will be kept if activemq_logger_config_keep_name: True. and it will then be passed to the JVM arguments as:

-Dlog4j.configurationFile=<custom_template>

Parameter recap:

Variable Description Default
activemq_logger_audit_rollover_files Number of rollover audit log files 5 'log4j2.properties' if activemq_version is version_compare('2.27.0', '>=') else 'logging.properties'
activemq_logger_config_template_path Optional subdirectory of any playbook template lookup directories for the logging facility configuration ''
activemq_logger_config_keep_name Whether to keep the custom template filename or use the default False

This change also refactor how JVM parameters are built in the role defaults; no changes will be needed to preserve behaviour if the activemq_java_opts parameter has already been overriden; otherwise, new parameters with defaults have been created that will be concatenated in the final JVM arguments, which can be overridden independently.

Variable Description Default
activemq_java_opts_extra Arbitrary extra arguments for the JVM ""
activemq_java_opts_mem Memory arguments for the JVM -Xms512M -Xmx2G"
activemq_java_opts_gc Garbage collection arguments for the JVM -XX:+PrintClassHistogram -XX:+UseG1GC -XX:+UseStringDeduplication
activemq_java_opts_hawtio Hawtio arguments for the JVM -Dhawtio.disableProxy=true -Dhawtio.realm=activemq -Dhawtio.offline=true -Dhawtio.rolePrincipalClasses=org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal

with activemq_java_opts now redefined as:

activemq_java_opts: "{{ [
   activemq_java_opts_mem,
   activemq_java_opts_gc,
   activemq_java_opts_hawtio,
   '-Djolokia.policyLocation=file:' + activemq_dest + '/' + activemq_instance_name + '/etc/jolokia-access.xml',
   activemq_java_opts_extra | default('')
 ] | join(' ') }}"

Fix #112