On Thursday, August 9, 2018 at 1:30:38 PM UTC-5, Michael Watters wrote: > > Hello, > > Is it possible to define metaparameters for a resource in Hiera? For > example, I have a class that is currently declared within another class as > follows. > > if !defined(Class['autofs']) { > class { 'autofs': > require => [ > Class['authconfig'], > Class['nfs::client'], > ], > } > } > > I would like to get rid of this mess and use a standard include statement > with parameters defined in my common.yaml as follows. > > include 'autofs' > > --- > autofs::require: > - "Class['authconfig']" > - "Class['nfs::client']" > > > Will this work or do I have to stick with resource-like declarations to > define dependencies? >
If you are going to definitely declare class autofs, as you show doing via an include statement, then your best bet is probably to use chain operators instead of metaparameters to express the wanted relationships: include 'autofs' Class['authconfig'] -> Class['autofs'] Class['nfs::client'] -> Class['autofs'] That combination means *exactly* the same thing as your resource-like declaration, and it makes no use of defined (which is good, because defined is evil). Consider also, however, whether you actually need those relationships at all. Is there in fact any reason for concern that applying class autofs before applying one or both of the other two might result in a Puppet failure or a target system misconfiguration? Those are the kinds of problems that Puppet relationships solve. It is neither necessary nor desirable to use relationships to express *functional* dependencies among the resources under management when they do not also impact the process of configuration management. 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 puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/efd20b4c-e84a-4f6a-9130-a1fcd18d681d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.