2

I'm using Puppet Dashboard as my ENC and I'm not sure how to reference or use class and group classifications from /etc/puppet/manifests/site.pp.

I have two groups defined in the dashboard: CentOS6 and SLES11. What should my site.pp look like if I want to include a certain list of modules in the CentOS6 group and a certain list of modules in the SLES11 group?

I'm trying to do something like this:

# /etc/puppet/manifests/site.pp

node basenode {
  include hosts
  include ssh::server
  include ssh::client
  include authentication
  include sudo
  include syslog
  include mail
}

node 'CentOS6' inherits basenode {
  include profile
}

node 'SLES11' inherits basenode {
  include usrmounts
}

I have OS-specific case statements within my modules, but there are some modules that will only be applied to a certain distro. So I suppose I have two questions:

  1. Is this the best way to apply modules/resources in an OS-specific manner? Or does the above make you want to vomit?
  2. Regardless of #1, I'm still curious as how to reference classes, groups, and nodes from Dashboard within my manifests. I've read the External Nodes doc, but I'm not seeing how they correspond to manifests.

Thanks all.

2 Answers 2

2

You are on the right track with the External Node Classifier. It is a bit difficult to wrap your head around, but one you get it working you will never look back and I cannot recommend doing it strongly enough. I went to the puppet IRC room when i had trouble and they helped me get mine working.

  1. Applying different modules based on OS is fine. I run a 300+ node environment with BSD and RHEL and we do it. Instead of having the the OS be a node, we have it as own class because . So instead of "node OS inherits basenode", we do have the ENC pass back something like this:

    node web-prod-007 {
      $node_environment="production"
      include web_server_class # this then inherits basenode
      include centos6::server # 
      include logging::rsyslog 
    }
    

    ...etc

how you do it depends on how you want your inheritance to work, if you want to modify the things in basenode depending on operating system, then having OS inherit basenode is the right way to go.

TLDR, what you are doing is okay, and look into ENC's because they make life easier.

EDIT: 2. I dont use Dashboard so I dont know.

2

OK I see how this works. Puppet Dashboard replaces site.pp, if you set dashboard up to be your External Node Classifier (ENC). Well, thats not completely true as you can use both:

ENCs can co-exist with standard node definitions in site.pp, and the classes declared in each source are effectively merged.

As I understand it, dashboard Classes = names of your puppet modules. And you can create Groups to group classes together to apply to a group of nodes. I've set up a CentOS6 group with all my CentOS 6 servers and per my old site.pp in my original question, it has all the Classes (modules) I want my CentOS 6 servers to have applied in their catalog. Adding nodes and classes to groups can all be done through the dashboard.

Another example:

site.pp:

node default {
  include iptables
  include selinux 
  include dns 
  include test
}

Converting the site.pp to Puppet Dashboard (screenshot):

Puppet Dashboard

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .