Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Is there a way to define wildcard hosts in puppetmaster´s nodes.pp

say i want all the hosts in one domain to receive a set of classes can i do something like:

# nodes.pp
#

node basenode {
  include  admina, adminb, admic
  }


node "*.acme.com" {
    include adminc
    }
share|improve this question

3 Answers 3

up vote 9 down vote accepted

Not in this way. You can create a 'default' node that will apply to any signed client.

node "default" {
   include foo
}

But you can only have 1 default. If you want to replicate the functionality you describe you can use the external_nodes method of classification. Basically you write a script that returns valid yaml when a client connects. That script can do it anyway you want, check fqdn, query a db, hit ldap, etc.

share|improve this answer
    
+1 Agree with external_nodes –  David Pashley Jun 5 '09 at 8:51

Regular expressions are now possible in Puppet 0.25, so what you want would be possible:

node /^(foo|bar)\.example\.com$/ {
include blah
}
share|improve this answer

Few distros ship 0.25 as of yet, so in my Centos5 having 2.24.8 from the EPEL repo I had to do something like this for my worker nodes with hostnames like wn10.example.com:

node  default {
    $node_type = regsubst($hostname, '^([a-z]+).*$', '\1')
    case $node_type{
        wn: {include worker_node}
        default: {include generic_node}
    }
}
share|improve this answer
    
Quick update - puppet-2.6.12-1.el5.noarch is now available from EPEL (supports regular expressions in node names). –  plasmid87 Dec 12 '11 at 16:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.