Hi Rob and ALL,
Unfortunately,
following pp file creating 1st instances and then are adding new
( I've tried just one ntp1 or triad ntp1,2,3 )
class ntpd{
service { ntpd:
name => "ntpd",
enable => true,
ensure => running,
require => File["/etc/ntp.conf"],
}
file { "/etc/ntp.conf" :
owner => "root",
group => "root",
mode => 664,
require => [Package["ntp"], Augeas["/etc/ntp.conf"]]
}
package { ntp: ensure => present }
augeas{"/etc/ntp.conf":
context => "/files/etc/ntp.conf",
changes => [
"set server[server = 'ntp1.example.com']
'ntp1.example.com'",
"set server[server = 'ntp2.example.com']
'ntp2.example.com'",
"set server[server = 'ntp3.example.com']
'ntp3.example.com'",
],
}
}
On Jul 12, 12:33 pm, Rob McBroom <[email protected]> wrote:
> On Jul 9, 2010, at 7:45 PM, altimon wrote:
>
> > How I should form onlyif condition with match to make it working:
> > now I have either it is not working at all or just accumulating
> > additional lines.
>
> I would avoid using a combination of “last()” and “onlyif” whenever possible.
> See the recent discussions on managing `/etc/services` and `/etc/sudoers`
> withAugeasto see what I mean.
Thank you, I'll look for it.
>
> I can’t test `ntp.conf` (don’t seem to have the lens for it), but just
> guessing something like this will do what you want reliably without having to
> craft a messy “onlyif”:
>
> augeas{"/etc/ntp.conf":
> context => "/files/etc/ntp.conf",
> changes => [
> "set server[server = 'ntp1.example.com'] ntp1.example.com",
> "set server[server = 'ntp2.example.com'] ntp2.example.com",
> "set server[server = 'ntp3.example.com'] ntp3.example.com",
> ],
> }
>
It can be anything else - like nameserver strings in resolv.conf etc.
> It looks weird, but I’ve done similar things and been much happier with the
> outcome. Basically, on the first run, there won’t be a path that matches
> “server = 'ntp1.example.com’” soAugeaswill create it and set the value. On
> subsequent runs, it finds something at that path, sees that it’s already set
> to the desired value, and does nothing. The syntax above might not work
> exactly as is, but hopefully you get the idea.
That is my basic question how to debug augeas - augtool is fine to
test some part of future puppet procedure/method but then I can't
debug what is happening at time of puppet execution, except that if I
have some syntax error.
Also where to look for all these functions like last()?
And where is description of augeas behavior?
Regards,
--Alex
Sample of log on client side:
Jul 12 16:04:25 host puppetd[25895]: triggered run
Jul 12 16:04:31 host puppetd[25895]: (//ntpd/Augeas[/etc/ntp.conf])
Failed to retrieve current state of resource: Error sending command
'set' with params ["/files/etc/ntp.conf/server", "["]/Error sending
command 'set' with params ["/files/etc/ntp.conf/server", "["]
Jul 12 16:04:31 host puppetd[25895]: (//ntpd/File[/etc/ntp.conf])
Dependency augeas[/etc/ntp.conf] has 1 failures
Jul 12 16:04:31 host puppetd[25895]: (//ntpd/File[/etc/ntp.conf])
Skipping because of failed dependencies
Jul 12 16:04:31 host puppetd[25895]: (//ntpd/Service[ntpd]) Dependency
augeas[/etc/ntp.conf] has 1 failures
Jul 12 16:04:31 host puppetd[25895]: (//ntpd/Service[ntpd]) Skipping
because of failed dependencies
Jul 12 16:04:31 host puppetd[25895]: Finished catalog run in 1.58
seconds
Jul 12 16:08:45 host puppetd[25895]: (//ntpd/Augeas[/etc/ntp.conf])
Failed to retrieve current state of resource: Error sending command
'set' with params ["/files/etc/ntp.conf/server", "["]/Error sending
command 'set' with params ["/files/etc/ntp.conf/server", "["]
Jul 12 16:08:45 host puppetd[25895]: (//ntpd/File[/etc/ntp.conf])
Dependency augeas[/etc/ntp.conf] has 1 failures
Jul 12 16:08:45 host puppetd[25895]: (//ntpd/File[/etc/ntp.conf])
Skipping because of failed dependencies
Jul 12 16:08:45 host puppetd[25895]: (//ntpd/Service[ntpd]) Dependency
augeas[/etc/ntp.conf] has 1 failures
Jul 12 16:08:45 host puppetd[25895]: (//ntpd/Service[ntpd]) Skipping
because of failed dependencies
Jul 12 16:08:45 host puppetd[25895]: Finished catalog run in 1.52
seconds
Jul 12 16:18:04 host puppetd[25895]: triggered run
Jul 12 16:18:10 host puppetd[25895]: (//ntpd/Augeas[/etc/ntp.conf]/
returns) executed successfully
Jul 12 16:18:11 host puppetd[25895]: Finished catalog run in 2.75
seconds
Jul 12 16:18:20 host puppetd[25895]: triggered run
Jul 12 16:18:27 host puppetd[25895]: (//ntpd/Augeas[/etc/ntp.conf]/
returns) executed successfully
Jul 12 16:18:27 host puppetd[25895]: Finished catalog run in 2.68
seconds
>
> --
> Rob McBroom
> <http://www.skurfer.com/>
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.