On Thursday, March 23, 2017 at 11:23:07 AM UTC-5, garima singh wrote: > > Hi, > > I was wondering if you could find a soultion to putting virtual resource > as target to require metaparameter. >
There is no inherent problem with making a resource depend on a virtual resource. It is syntactically valid, and in itself it is semantically valid. The problem arises if that resource is never realized for the target machine, and I suppose that's the issue you want help with. I have to ensure that some resource is run only when a particular virtual > resource is run and successful. > > Every concrete resource in the catalog is applied to the target machine. If you want a given resource to not be applied under certain circumstances, then you must ensure that it is declared only virtually if at all. Virtual resource realization does not cascade along dependencies; if you're looking for a way to make that happen, then you need to take a step back and re-think your approach. Your best option may be to wrap [realization of] the two resources in question in a class or defined type, so that you can cause them to be realized as a pair. You may realize the same virtual resource multiple times with no ill effects, but this does not achieve the result of realization of one resource causing realization of the other. You might also consider restructuring your manifest set to avoid relying on virtual resources at all. These days it's more conventional to rely on external data (i.e. Hiera) to drive decisions about which classes and resources to declare, and this can replace the decision of whether to *realize* a declared virtual resource with a decision of whether to *declare* an ordinary resource in the first place. John -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/3aed0c24-9fef-46ca-8120-f7d1a787807e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
