On 04/18/2011 11:50 AM, Wilmer van der Gaast wrote:
> Hello,
>
> To avoid silly micro-management of my "fleet" I've started using
> Puppet. Now I'm probably missing some "best practices".
>
> I'm currently getting a "Duplicate definition: Service[cron] is
> already defined" on my configs. Indeed there are two places that
> define the service. One's the duplicity module:
>
> # Ensure that cron is enabled and running.
> @service { cron:
> ensure => running,
> enable => true,
> }
>
> The other one is in my timezone update class:
>
> service { ["cron", "rsyslog", "atd"]:
> subscribe => [File["/etc/localtime"], File["/
> etc/timezone"]];
> }
>
> These are two *completely* independent things. I suppose I can just
> remove the clause from duplicity since I don't see why I would not be
> running cron everywhere, but I still wonder how one is supposed to
> deal with a situation like this, since it will probably happen to me
> again.
>
> I've found the Service["cron", "rsyslog", "atd"] { ...} syntax but it
> didn't work either, saying it can only be used to override definitions
> of a parent class (IIRC).
Hi,
that's one way to do it. Add a subclass to the class that defines the
service in question and override the service definition such as to
subscribe the appropriate resources. Then include that subclass at will.
However...
> If anyone knows I'd be delighted to know.
This case is much simpler. Add a 'notify => Service["cron"]' to the file
resources instead of using subscribe.
HTH,
Felix
--
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.