seph
2010-Aug-06 18:26 UTC
[Puppet Users] purging a managed directory and exported resources
I''m trying to use puppet to manage a directory full of files. Files are
each a collected resource. In my case, they''re part of nagios. But I
can''t really get it to work. The purge on the directory
doesn''t take
into account the collected resources, so they end up racing.
My code is basically:
class server {
Nagios_service <<||>>
file { "/etc/naginator/services.d":
ensure => directory,
recurse => true,
replace => true,
purge => true,
require => File["/etc/naginator"],
}
}
class target {
@@nagios_service { "check_ping-${hostname}":
ensure => present,
check_command => "check_ping!100.0,20%!500.0,60%",
use => "generic-service",
host_name => "$fqdn",
target => "/etc/naginator/services.d/ping-$fqdn.cfg",
}
}
I see a couple of threads from last year about this, but no really
satisfying conclusions. It sounds like most people end up adding a
dependency which causes everything to purge and then be recreated
anew. Which feels like a lot of churn.
Do folks have a nice solution for this?
seph
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
seph
2010-Aug-06 18:56 UTC
[Puppet Users] Re: purging a managed directory and exported resources
Oh, this is 0.25.4 seph seph <seph@directionless.org> writes:> I''m trying to use puppet to manage a directory full of files. Files are > each a collected resource. In my case, they''re part of nagios. But I > can''t really get it to work. The purge on the directory doesn''t take > into account the collected resources, so they end up racing. > > My code is basically: > > class server { > Nagios_service <<||>> > > file { "/etc/naginator/services.d": > ensure => directory, > recurse => true, > replace => true, > purge => true, > require => File["/etc/naginator"], > } > } > > class target { > @@nagios_service { "check_ping-${hostname}": > ensure => present, > check_command => "check_ping!100.0,20%!500.0,60%", > use => "generic-service", > host_name => "$fqdn", > target => "/etc/naginator/services.d/ping-$fqdn.cfg", > } > } > > I see a couple of threads from last year about this, but no really > satisfying conclusions. It sounds like most people end up adding a > dependency which causes everything to purge and then be recreated > anew. Which feels like a lot of churn. > > Do folks have a nice solution for this? > > seph > > -- > 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+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.-- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Peter Meier
2010-Aug-08 22:09 UTC
Re: [Puppet Users] purging a managed directory and exported resources
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 08/06/2010 08:26 PM, seph wrote:> I''m trying to use puppet to manage a directory full of files. Files are > each a collected resource. In my case, they''re part of nagios. But I > can''t really get it to work. The purge on the directory doesn''t take > into account the collected resources, so they end up racing. > > My code is basically: > > class server { > Nagios_service <<||>> > > file { "/etc/naginator/services.d": > ensure => directory, > recurse => true, > replace => true, > purge => true, > require => File["/etc/naginator"], > } > } > > class target { > @@nagios_service { "check_ping-${hostname}": > ensure => present, > check_command => "check_ping!100.0,20%!500.0,60%", > use => "generic-service", > host_name => "$fqdn", > target => "/etc/naginator/services.d/ping-$fqdn.cfg", > } > } > > I see a couple of threads from last year about this, but no really > satisfying conclusions. It sounds like most people end up adding a > dependency which causes everything to purge and then be recreated > anew. Which feels like a lot of churn. > > Do folks have a nice solution for this?imho, you need define an empty source for the services.d directory resource, this will purge it: http://projects.puppetlabs.com/projects/1/wiki/Frequently_Asked_Questions#I+Want+To+Manage+A+Directory+and+Purge+Its+Contents cheers pete -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkxfKx0ACgkQbwltcAfKi39LpACffJHs6ZcyZJuVGlBOC9x871Q8 tIgAn1xM9E+js3S62X6GB1N0gZypfXMH =hH46 -----END PGP SIGNATURE----- -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.