On Wed, Sep 21, 2016 at 9:33 AM, Peter Faller <pgfal...@gmail.com> wrote:

> What is the effect of the 'require' metaparameter when ensure is set to
> absent, i.e. when a resource
> is removed? It seems that changes to the required resource are applied
> before changes to the requiring
> resource are applied - is that always the case?
> When one resource (R1) depends on another resource (R2) to be able to be
> created, having R1::require=>R2 works as expected - R2 is created first,
> then R1. (My case is where R2 is a configuration file that has to be
> present for R1 to be created). But now in my case, R2 has to be present for
> R1 to be removed as well. Having R1::require=>R2 and both
> R1::ensure=>absent and R2::ensure=>absent results in R2 being removed
> before R1 is removed; where I am trying to get R1 removed before R2 is
> removed.

The require merely implies that R2 should be "managed" before R1, and
"managed" being setting the desired state (absent, present...etc) so the
actual value of ensure is unimportant here.

If you want to change your requirements based on the value of ensure you
could do something like....

if $ensure == 'present' {
  Resource['one'] -> Resource['two']
elsif $ensure == 'absent'
  Resource['two'] -> Resource['one']


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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
For more options, visit https://groups.google.com/d/optout.

Reply via email to