Ask Your Question

Managing a single template from multiple modules

asked 2013-10-10 21:54:28 -0600

STOIE gravatar image

Hi there,

I have some situations where I need to manage a single file and possibly even single value in that file. ie. limits.conf.

You have the one config: /etc/security/limits.conf And even one value, specific user, specific config item, specific value.

That needs to be modified (err controlled) by more than a single module.

Okay, lets say a user (foo), is running a tomcat server, which runs java apps. Now, in puppet, I am controlling both the tomcat server itself AND all the apps under it.

Now, initially that tomcat server only runs one application, so ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-10-10 23:31:22 -0600

Ancillas gravatar image

updated 2013-10-10 23:32:12 -0600

You could define the limits value of each app in a separate Hiera file, and then sum them with an inline template.

hiera file for app 1

 - 6

hiera file for app 2

 - 4

Puppet code

$limits_array = hiera_array('limits')
$limits_sum   = inline_template('<%= @limits_array.inject{|sum,x| sum + x} %>')

Otherwise, I suppose you could do something crafty with PuppetDB and a custom fact for storing a limits value, but that would be more complicated.

Honestly, you could just create a simple module for setting limits.conf, and then pass in a value that you config as you add apps to the server.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-10-10 21:54:28 -0600

Seen: 128 times

Last updated: Oct 10 '13