Hi everybody,
I'm a new puppet user, and I have a question about defined types and
relationships.
I want a defined type to be part of a module.
It manages optional configuration files, so the user can decide to declare
it one or more times or not to declare it at all.
In the case the defined type is declared, I want the contained resources to
be in relationship with other resources in my main module class; in
particular, I want the resources in the defined type to be managed *after*
package and *before* service.
Two ways come to mind:
1) embed the necessary require/before (and/or subscribe/notify) inside the
the defined type's resources:
# == Define: software::mydefinedtype
define software::mydefinedtype {
file { "/path/to/${name}":
[...]
require => Package['software'],
before => Service['software'],
}
}
2) rely on dependency chains and a resource collector in the main module
class (and of course on the containment properties of defined types):
# == Class: software
class software {
[...]
Package['software'] -> Software::Mydefinedtype <| |> ->
Service['software']
}
What is, in your opinion, the best method?
I've tried both, and both apparently work with no issues.
One doubt about method 2:
at http://docs.puppetlabs.com/puppet/3/reference/lang_relationships.html, I
can read:
"If one of the resources in a relationship is never declared, compilation
will fail with one of the following errors [...]"
I suppose that this doesn't apply in case of resources chained through
resource collectors, does it? I'm asking because, even without declarations
of instances of the defined type, I got no such errors.
Thanks a lot for your help!
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.