I can't help with your Dashboard problems, but can suggest an alternative to file fragments that you might find easier to work with. I would use a Defined Type wrapped around Augeas where the $namevar of the Defined Type is the name of the systctl.conf key. This way if you tried to turn ipv6 on and off at the same time you'd get a Puppet resource conflict.

Something like this:

define syssctl_line($value) {
  $sysconfig_file = "/etc/sysctl.conf"
  augeas { "set ${name} in ${sysconfig_file}":
    context => "/files${sysconfig_file}",
    incl    => "$sysconfig_file",
    lens    => "shellvars.lns",
    changes => [ "set ${name} ${value}"]
  }
}

And used like this:

class foo {
  sysctl_line { "net.ipv4.ip_forward": value => "0" }
  sysctl_line { "kernel.sysrq": value => "0" }
  #And this would cause an error on a node...
  sysctl_line { "net.ipv4.ip_forward": value => "1" }
}

On 19/03/12 19:12, Scott Merrill wrote:
We'd like to control, among other files, /etc/sysctl.conf with Puppet.
We have a baseline for this file on all our servers, but frequently
some of our applications require additional tweaks. These tweaks are
generally more than a single line.

I know that we could create a class in our module repository with the
necessary additions, then define that class inside Dashboard and apply
it to hosts as needed. That seems a little inflexible, as we'd need to
create a class for each app, and define inside that class the changes
that we need.

I'd prefer a more extensible solution that abstracts this a bit. A
"sysctl-additions" class, for example, that relies upon a
Dashboard-defined variable that contains the additions to place into
the file. But how can I (easily?) add multiple lines to the Dashboard
variable? Or do I have to create multiple key/value pairs for each
line I wish to add?

When using Puppet Dashboard, how does one easily add multiple lines to
a Puppet-controlled file? Or should we not be using Dashboard for
that?



--
Luke Bigum

Information Systems
Ph: +44 (0) 20 3192 2520
luke.bi...@lmax.com | http://www.lmax.com
LMAX, Yellow Building, 1A Nicholas Road, London W11 4AN


The information in this e-mail and any attachment is confidential and is 
intended only for the named recipient(s). The e-mail may not be disclosed or 
used by any person other than the addressee, nor may it be copied in any way. 
If you are not a named recipient please notify the sender immediately and 
delete any copies of this message. Any unauthorized copying, disclosure or 
distribution of the material in this e-mail is strictly forbidden. Any view or 
opinions presented are solely those of the author and do not necessarily 
represent those of the company.

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to