On May 3, 6:27 am, Josh <[email protected]> wrote: > Now, in the 'my_network' module I have a definedtype that generates > /etc/network/interfaces from a given ERB template which is associated with > the platform, simplified version: > > define my_network::interfaces ($template = $title) { > file { '/etc/network/interfaces': > ensure => present, > content => template($template), > } > > }
I don't like that at all. Generally speaking, defined types should not manage resources whose identity is independent of the type parameters. In your case, that implicates File['/etc/network/ interfaces']. If a defined type manages such a resource then at most one instance can be declared, and for that you're usually better off with a class. I don't particularly care for parameterized classes, but in this case your design already suffers from all the problems attending them. Switching the definition to a parameterized class would at least have the benefit of modeling the desired configuration more precisely. Ideally, though, you would switch to an *un*parameterized class, and communicate the erstwhile parameters to it via external data (e.g. Hiera) and/or by creating separate [sub-]classes. 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.
