I think I solved my own problem. Now things look like this. I can still do
specific node overrides, but this seems to do what I'm hoping for.

If there's a better way to do this sort of thing I'm happy to be corrected.

class general {
  include dsh
  include getty
  include grub
  include ntp
  include postfix
  include ssh
  include sudo
  include sysadmin
}

node default {
  $role = inline_template('<%= hostname.sub(/\w+-([a-z]+)\d*/){$1} %>')
  include general
}

On Mon, Feb 7, 2011 at 4:46 PM, Joe Gross <jgr...@stimpy.net> wrote:

> Hi all,
>
> I'm new to puppet put did a lot with cfengine2 at my last gig. I'm using
> v0.25.4 (default) on Ubuntu Lucid but can upgrade to 2.6 if necessary.
>
> I have a few hundred (with more on the way) machines in a new datacenter. I
> have about a dozen classes of hosts, designated by <dc>-<function><n>, so
> for example:
>
> sjc-web29
> sjc-db35
> sjc-smtp3
>
> My nodes.pp is super-simple this way:
>
> node default {
>   include dsh
>   include getty
>   include grub
>   include ntp
>   include postfix
>   include ssh
>   include sudo
> }
>
> This worked really well in cfengine, allowing me to keep decisions
> self-contained within individual modules. I'm trying to do the same with
> puppet without any luck so far. Ideally I'd do something like:
>
> $role = inline_template("<%= %x{/bin/hostname | /bin/sed -re
> 's/.*\-(\w+)[0-9]/\1/g'} %>")
> tag("type_${role}")
>
> And then do if tagged("role_smtp") within the modules. This keeps my high
> level simple in that I just call modules and they do the right thing.
>
> The problem is this doesn't seem to work. It seems that $role and the tags
> never get set, even if I try to set them manually so I'm clearly doing
> something fundamentally wrong.
>
> Has anyone done this type of setup where all the decisions are made within
> the modules themselves based on parts of a hostname or tags? I'm happy to
> provide more information or post more bits of my config if needed.
>
> Thanks!
>
> Joe
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
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