Is the "resources" type primarily useful for purging? Is it also
commonly used for metaparameters? The documentation[1] says this, but
I haven't used it much myself, and I don't know what common use is.
Thanks!
r
----
1. http://docs.puppetlabs.com/references/stable/type.html#resources
(Search for "metatype" to see it; the "resources" anchor is bugged.)
Yep, it's used when you fully manage a resource and wish to purge any
unknown/unmanaged resource of that type.
The limitation is you must be able to inspect the resource (verify if
you can run puppet resource [type]), and it doesn't quite work for
package resource (since it doesn't detect multiple kernel packages).
Also friendly reminder to use noop if you are trying it out.
resources { 'host':
purge => true,
}
Thanks,
Nan
> Is the "resources" type primarily useful for purging? Is it also
> commonly used for metaparameters? The documentation[1] says this, but
> I haven't used it much myself, and I don't know what common use is.
I get the impression you are confused about what the part about
metaparameters in the documentation actually means. If you use
a metaparameter (like 'noop' or 'loglevel') in a "resources"
declaration, they will apply to that particular purging; they
won't apply to normal declarations for that type.
Assume for example that you have the following manifest:
resources {
"user":
purge => true, noop => true, loglevel => crit;
}
user {
"randall":
uid => 4711, ensure => present;
}
The 'noop' and 'loglevel' parameters will not apply to the
"randall" user. What happens, is that when Puppet is run,
it will check which users exist on the system; let's assume
it finds the users "root", "apache" and "randall" (i.e., your
account has already been created). Internally, Puppet will
generate the following extra resource declarations:
user {
[ "root", "apache" ]:
ensure => absent, noop => true, loglevel => crit;
}
Since you have explicitly managed the "randall" user, that
will not be included in those extra generated resources. So
the total list of resources that will be applied will be:
user {
[ "root", "apache" ]:
ensure => absent, noop => true, loglevel => crit;
}
user {
"randall":
uid => 4711, ensure => present;
}
And as you see, the "randall" declaration does not have any
noop or loglevel metaparameters.
Does this help your understanding?
/Bellman