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?
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?
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" }
}
--
Luke Bigum
Information Systems
Ph: +44 (0) 20 3192 2520
luke....@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.
After reviewing Luke's suggestion and thinking things through a little
more, I think this is the right way to go for us. I hadn't really
considered the long-term ramifications of putting configuration
declarations in both Puppet manifests and in Dashboard. Much better to
keep all configurations in manifests under version control, and use
Dashboard to associate configurations to nodes.
Cheers,
Scott
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet...@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>