From dda533ad21f8d21b3c2498295e4c9563318a7620 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Mon, 4 Jan 2016 16:40:41 -0600 Subject: [PATCH 1/3] Allow the use of ERB templates to provide the ActiveMQ configuration file --- manifests/init.pp | 14 +++ templates/activemq_template.erb | 161 ++++++++++++++++++++++++++++++++ 2 files changed, 175 insertions(+) create mode 100644 templates/activemq_template.erb diff --git a/manifests/init.pp b/manifests/init.pp index 4978ae8..8c355e7 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -28,6 +28,7 @@ $package_type = $activemq::params::package_type, $architecture_flag = $activemq::params::architecture_flag, $activemqxml_source = undef, + $activemqxml_content = undef, ) inherits activemq::params { validate_re($package_type, '^rpm$|^tarball$') @@ -35,6 +36,10 @@ if $activemqxml_source and (!$console or defined(Class['activemq::stomp'])) { fail('If you set activemqxml_source, console needs to be true and activemq::stomp must not be defined.') } + + if $activemqxml_source and $activemqxml_content { + fail('The content of the activemq configuration may only be defined as a constant file or erb template') + } if $activemqxml_source { file { "${activemq::home}/activemq/conf/activemq.xml": @@ -44,6 +49,15 @@ source => $activemqxml_source, } } + + if $activemqxml_content { + file { "${activemq::home}/activemq/conf/activemq.xml": + ensure => present, + owner => $user, + group => $group, + content => $activemqxml_content, + } + } $wrapper = $package_type ? { 'tarball' => "${home}/activemq/bin/linux-x86-${architecture_flag}/wrapper.conf", diff --git a/templates/activemq_template.erb b/templates/activemq_template.erb new file mode 100644 index 0000000..98a780f --- /dev/null +++ b/templates/activemq_template.erb @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <% if @console %> + + + <% end %> + \ No newline at end of file From 5f9adef2cc279ca8d001118b2d2771470d35855f Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Mon, 4 Jan 2016 16:51:29 -0600 Subject: [PATCH 2/3] Since the file may contain credentials, secure it. --- manifests/init.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/init.pp b/manifests/init.pp index 8c355e7..9d61054 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -55,6 +55,7 @@ ensure => present, owner => $user, group => $group, + mode => '0400', content => $activemqxml_content, } } From 7906ee66c718fe665bc71e72bd58c9a9e1037654 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Mon, 4 Jan 2016 16:52:27 -0600 Subject: [PATCH 3/3] Since the file may contain credentials, secure it. --- manifests/init.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/init.pp b/manifests/init.pp index 9d61054..3eb2d4b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -46,6 +46,7 @@ ensure => present, owner => $user, group => $group, + mode => '0400', source => $activemqxml_source, } }