Skip to content

Instantly share code, notes, and snippets.

@endzyme
Last active December 14, 2015 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save endzyme/5146965 to your computer and use it in GitHub Desktop.
Save endzyme/5146965 to your computer and use it in GitHub Desktop.
concat use for active mq configuration file populating static clustered known hosts. -- Updated for better handling of filtering. -- This method of Exported Resources with multiple filters will require PuppetDB running.
# When you build your ERB files you should split them up into header and footer around
# the dynamic area. Which also sucks. Wish there was a better way of getting stored
# configs out of puppet upon runtime.. Like maybe into variables.
class activemq::activemqconfig () {
include concat::setup
concat {'/usr/local/activemq/apache-activemq-5.5.1/conf/activemq.xml':
owner => 'activemq',
group => 'activemq',
mode => '0644',
#require => Package['activemq'],
#notify => Service['activemq']
}
concat::fragment { 'activemq_configuration_file_header':
target => '/usr/local/activemq/apache-activemq-5.5.1/conf/activemq.xml',
order => '10',
content => template('activemq/activemq_header.xml.erb')
}
@@activemq::activemqbrokers { "brokerIP-${::hostname}":
target => '/usr/local/activemq/apache-activemq-5.5.1/conf/activemq.xml',
order => '20',
content => template('activemq/activemq_ip_list.xml.erb'),
tag => ["activemq_broker_${::host}","env_${::environment}"]
}
Activemq::Activemqbrokers <<| tag != "activemq_broker_${::host}" and tag == "env_${::environment}" |>>
concat::fragment { 'activemq_configuration_file_footer':
target => '/usr/local/activemq/apache-activemq-5.5.1/conf/activemq.xml',
order => '30',
content => template('activemq/activemq_footer.xml.erb')
}
}
# Abstracted to help filter out not potentially collecting all
# concat::fragment resources by accident.
define activemq::activemqbrokers ($target, $order, $content) {
concat::fragment {$name:
target => $target,
order => $order,
content => $content
}
}
<!-- the top of the activemq stuff -->
<!-- snip -->
<networkConnectors>
<networkConnector uri="static:(
ssl://<%= @ipaddress %>:62001,<%# note no \n %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment