Hi all,

I'm currently redoing our puppet setup and trying to start with new design 
from the ground up to implement all of the puppet 2.6+ goodness, but I'm 
getting tripped up with the complexity of the design. I want to do things 
the right way, but I don't want to introduce additional complexity, which is 
what I feel like I'm doing. The best example I can come up with is for an 
NTP module, since puppet docs use it a lot. I'll just describe how I imagine 
it should work from my understanding of the style guide and the 
parameterized class documentation, and hopefully someone can help clear it 
up a bit by either telling me I'm on the right track or that I'm hitting the 
crack pipe a bit too hard. For the sake of simplicity, I've left out 
ntp::server, but it looks the same as ntp::client.

Here's how it looks:

modules/ntp/params.pp
  defines the usual stuff:
    - $supported = true for supported OS
    - per-os package name/version default
    - per-os service name default
    - default config file path
    - default ntp server to be used in the template that generates the 
config files

modules/ntp/file.pp
  - inherits ntp::params
  - uses template to generate and copy $ntp::params::config_file (which uses 
data from ntp::params)
  - notifies Class["ntp::client::service"] on config file change

modules/ntp/package.pp
  - inherits ntp::params
  - installs $ntp::params::package_name (aliases it Package["ntp"])
  - notifies Class["ntp::client::service"] on package installation

modules/ntp/client/service.pp
  - inherits ntp::params
  - makes sure $ntp::params::service_name is running (aliases it 
Service["ntp_client"]

modules/ntp/client/init.pp
  - includes ntp::params
  - checks to make sure $ntp::params::supported is set, exiting if not
  - includes ntp::file ntp::package, ntp::client::service

So is this "correct" or is it just unnecessarily complicated? The goal is to 
include only "ntp::client" for a node, and then let ntp::client call in all 
of the other ntp classes as needed.

My main confusion here is how I specify something like a different ntp 
server or something for an ntp client. What worries me is that I have the 
relationship chained like this:

ntp::client --(includes)--> ntp::file --(inherits)--> ntp::params

I use an ENC, so if I want to use parameterized classes to tell ntp::client 
to use a different ntp server from the default, I wanted to output something 
like:

classes:
  ntp::client
    ntpserver: 0.pool.ntp.org
  
but "ntpserver" isn't really a parameter of ntp::client, it's a parameter of 
ntp::params, which ntp::client accesses through ntp::file. Would I just do 
something like

classes:
  ntp::client
  ntp::params
    ntpserver: 0.pool.ntp.org

What I'd really like to do is to use the first syntax and just have 
ntp::client pass the "ntpserver=0.pool.ntp.org" parameter into ntp::file, 
which would then pass it into ntp::params, so that ntp::params::ntpserver 
would be the server I specified in the ENC output. Is there a way to achieve 
this? I wanted to have the ENC script depend as little as possible on the 
internal organization of the ntp module so that I can say "here's your ntp 
server. I don't care what subclass you use it in. Just take it and use it 
where you need it."

I feel like even my question is completely muddled, so if I've made 
something so unclear you can't understand what I'm asking, please don't 
hesitate to ask for clarification.

Thanks very much,

David

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/mMgmIDOpV18J.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to