On Feb 17, 2:25 pm, Forrie <[email protected]> wrote:
> I have another related question.  What happens when a virtual resource
> such as an NFS mount is not longer needed -- how do you prune that
> from the systems that had it "realized"?   Can you "unrealize" them?

First, let's get the conceptual framework right.  Realizing a virtual
resource for a given node tells Puppet that you want to manage that
resource for that node.  Whether it implies the resource will then be
present depends on the resource's declared properties.  You can always
change your manifest so that those resources are no longer realized on
those nodes, but that won't do what I think you're looking for.

It is important to understand that by default, omitting a resource
from a node's catalog simply leaves it unmanaged, which is not at all
the same thing removing it from the node.  An unmanaged resource might
or might not be present, and if present its properties might have any
values.  From a Puppet perspective, omitting a resource from a node's
catalog means "I don't care."

Most Puppet resource types support particular parameter values that
indicate that the resource should be absent from the node.  Typically,
including for the Mount resource type, that's spelled "ensure =>
absent".  Thus, to get rid of a mount on certain nodes, simply arrange
for the ensure parameter of its corresponding Mount resource to take
the value "absent".  Puppet has several flavors of conditional
statements that can help achieve that.  Advanced Puppeteers might
sometimes use class inheritance to achieve the result by overriding
resource properties.  If the resource is virtual, then you will have
to realize it for that to have any effect.

If, however, you are looking to control on every node whether a
particular resource is present (and if so, its properties), then you
don't want a virtual resource at all.  Instead, you want a concrete
resource whose "ensure" property you twiddle appropriately.

It is also possible to instruct Puppet to remove all unmanaged
resources of given types (see the Resources resource type), but
proceed with extreme caution if you take that approach.  As a special
(but common) case, you can purge unmanaged files and subdirectories of
a given directory via the File resource type's "purge" parameter.


HTH,

John

-- 
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.

Reply via email to