class foo ($param1, $param2, ... $paramN) {
contain foo::install
contain foo::config
contain foo::service
Class['foo::install'] -> Class['foo::config'] -> Class['foo::service']
}
class profile::foo ($param1 = 'my_default', $param2 = 'other_default', ... $paramN) {
foo {
param1 => $param1,
param2 => $param2,
...
paramN = $paramN,
}
}class profile::foo ($param1 = 'my_default', $param2 = 'other_default', ... $paramN) {
contain profile::foo::install
contain profile::foo::config
contain profile::foo::service
Class['profile::foo::install'] -> Class['profile::foo::config'] -> Class['profile::foo::service']
}Option A, 100%.Why change your coding pattern just because a module isn't from the Forge? Who knows, maybe one day you'll post it yourself on the Forge!
Sometimes I do the full parameter workup like in your example, and sometimes I just use `include` and let Hiera fill in the parameters, without having to add 'profile::' at the beginning of every parameter.
You seem to be making things more complicated by using `contains` and those Refresh arrows though. Why not just use `include`?
Either you need to manage that
complexity or you don't.
I've done the same thing in the past, just use Hiera to provide params to technology modules. It feels a little off, it seems like the "right" way is to wrap a technology module in a profile and then put the profile:: params in Hiera.
Honestly I was just putting a few w things in my example class to flesh it out but I used contain because I use the Puppetlabs NTP module as my template or benchmark. The subtleties of `include` vs `contain` evade me.
From my understanding the contains ensures that all work in that class (and sub classes) is completed before moving on to the next contains class. With include I believe puppet could move on to the next class. The contains works nice with the install > config > service model.
-Kurt
From: puppet...@googlegroups.com <puppet...@googlegroups.com>
On Behalf Of A Manzer
Sent: Tuesday, June 9, 2020 7:23 AM
To: Puppet Users <puppet...@googlegroups.com>
Subject: [Puppet Users] Re: [Roles/Profiles] when a technology module doesn't already exist - seeking opinions
|
--
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...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/7181b554-99b5-4e64-80f2-90a7e1e12b76o%40googlegroups.com.