I think i had a similar problem some time ago. The best way around it
(whoa that''s a loaded statement : ) ) is to:
Move your recursive etc pushout into a module, and tell anything that
also wants to write into /etc to do so with a
require => File["/etc"],
That way your /etc/ from your preferred source is there, and
subsequent files can write into it.
Now ... i don''t recall if the recursive replace removes everything
first, but i think it does, which really isn''t what you want.
The way i worked around that (best way version 2.0) i found was to use
a tarball that injects the contents into the directory you want, for
example i deploy private keys into home directories as follows:
define homedir_deployment($filename)
{
file
{ "/tmp/$filename":
owner => root,
group => root,
mode => 600,
replace => true,
source => "puppet:///shared-home_directories/
$filename",
before => Exec["extract_$filename"],
}
exec
{ "extract_$filename":
command => "${variables::tar_cmd} xzpf /tmp/
$filename",
cwd => "/",
before => Exec["remove_$filename"],
}
exec
{ "remove_$filename":
command => "${variables::rm_cmd} -f
/tmp/$filename",
cwd => "/",
}
}
So it transfers to /tmp/tarball; then extracts tarball (which is tared
so it extracts /home); and then it removes the temp file.
The same can work for your /etc directory, and that way when you
deploy your ntp configuration whenever you want.
Hope that helps
chakkerz
On Apr 9, 9:44 am, "Jesús M. Navarro" <jesus.nava...@andago.com>
wrote:> Hi, list:
>
> I''m a rookie on his first tests with Puppet and I found something
that it''s
> probably obvious but that still don''t understand.
>
> I have some modules that manage some files under /etc/
> (say, /etc/resolv.conf, /etc/ntp.conf, etc.) and then, since I
"inherited"
> quite a lot of files managed by hand under Subversion, a lot of files that
go
> directly under the "private" resource in order to be moved
''as is'' from the
> puppetmaster to its clients.
>
> The thing is that if I have a client that calls any module that
"touches" any
> file under /etc, the "private" resource seems to go unnoticed
unless I first
> run the puppetd client without any module so the client "notices"
the files
> under "private". Once the client "sees" once the
"private" section
> everything goes OK from there on.
>
> An example: let''s say I have a "node" definition like
this:
> node "somehost.example.com" inherits myCompanyBasic {
> file { "/etc":
> recurse => "true",
> source => "puppet:///private/etc";
> }
>
> }
>
> ...where "private" is defined within fileserver.conf as...
> [private]
> path /etc/puppet/private/%d/%h
>
> ..and there exists within the puppetmaster a file like:
> /etc/puppet/private/example.com/somehost/etc/foo/bar
>
> ...and myCompanyBasic is defined like this:
> node myCompanyBasic {
> # NTP client
> include ntp::client
>
> }
>
> All that ntp::client does is this (the parent ntp class is just a
"noop" by
> now):
> class client inherits ntp {
> File["/etc/ntp.conf"] {
> source =>
"puppet:///ntp/ntp-client.conf",
> }
> }
>
> The file "ntp-client.conf" is properly sent to the client as
/etc/ntp.conf but
> neither /etc/foo/bar is sent to the client nor the logs show nothing (even
> when running as puppetd --no-daemonize --debug).
>
> I can tell that /etc/puppet/example.com/somehost/etc is somehow managed
since
> if I delete it on the server I''ll get a client-side error:
> (//Node[somehost.example.com]/File[/etc]) Failed to retrieve current state
of
> resource: No specified source was found from puppet:///private/etc
> ...although if /etc/puppet/example.com/somehost/etc exists on the server no
> file within it will be sent to the client.
>
> Now, if I change my host definition *not* to depend on the global class,
like
> this (see there''s no "inherits myCompanyBasic" here):
> node "somehost.example.com" {
> file { "/etc":
> recurse => "true",
> source => "puppet:///private/etc";
> }
>
> }
>
> Then /etc/puppet/example.com/somehost/etc/foo/bar is properly sent to the
> client as /etc/foo/bar and if I make a change
> to /etc/puppet/example.com/somehost/etc/foo/bar on puppetmaster it will be
> properly managed *even* if I return afterwards to the original definition
for
> somehost.example.com inheriting myCompanyBasic and I restart both
> puppetmaster and puppetd: it will then and afterwards properly manage
*both*
> the files (and templates) managed by modules and those from the
"private"
> resource.
>
> Is this a known bug, something I misunderstood or what?
>
> I''m using puppet 0.24.5 from Debian Stable ("Lenny")
both on server and
> client.
>
> TIA.
>
> --
> 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
athttp://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.