On 11/1/2012 12:12 PM, romario nguyen wrote:
Does any one know how to evaluate a node hostname in the nodes.pp file?
for example something like this..
node 'node1.com', 'node2.com', 'node3.com' {
case node.name {
'node1.com' : { include solaris }
'node2.com' : { include redhat }
'node3.com' : { include aix }
default: { include generic }
}
Much appreciated your feedback. Thanks!
You might consider letting regex and facter do more of the work for you.
node /^node\d+\.yourdomain\.com$/ {
include $::osfamily # or the more specific $::operatingsystem
}
However if you were to build a case around the node name you can use
$::hostname or $::clientcert. I use clientcert more often because the
hostname is not always correct through provisioning in my system. Same
syntax either way.
node /^fe\d+\.(ord|lax|sfo)\.mydomain\.com/ inherits basenode {
include hostgroup::frontend
case $::clientcert {
/^fe02(.*)/: { # matching any server named fe02
cron::listings { 'listings':
cron_env => 'production_migrate',
cron_user => 'deploy',
}
}
default: {}
}
}
Ramin
--
You received this message because you are subscribed to the Google Groups "Puppet
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.