Setting hostnames in razor

120 views
Skip to first unread message

Kyle Sexton

unread,
Aug 2, 2012, 2:02:25 PM8/2/12
to puppet...@googlegroups.com
All,

Is razor only really useful for configuring mass numbers of hosts?  I've been playing with it and one thing I'm not grasping is how to set a hostname if I'm only building one host, say wiki01.foo.com.  For each server like that would I need a separate policy, or is there some other way people are using to pre-populate specific host information to be passed to servers?

--
Kyle Sexton

Nan Liu

unread,
Aug 2, 2012, 3:03:09 PM8/2/12
to puppet...@googlegroups.com
Yes, you need separate model per system. We have a pending pull
request to make this as simple as a puppet manifests that you can
apply:

rz_image { 'precise_image':
ensure => present,
type => 'os',
version => '12.04',
source => '/mnt/nfs/ubuntu-12.04-server-amd64.iso',
}

rz_model { 'wiki_model':
ensure => present,
image => 'precise_image',
metadata => {'domainname' => 'foo.com', 'hostname_prefix' =>
'wiki', 'root_password' => 'puppet'},
template => 'ubuntu_precise',
}

rz_policy { 'wiki':
ensure => 'present',
broker => 'none',
model => 'wiki_model',
enabled => 'true',
tags => ['virtual'],
template => 'linux_deploy',
maximum => 1,
}

So you can definitely write a define resource type to wrap the puppet
resource above to create one off systems:

define system (
$rz_tags
) {
# parse hostname/domainname.

rz_model { $name:
ensure => present,
image => 'precise_image',
metadata => {'domainname' => $rz_domain, 'hostname_prefix' =>
$rz_hostname, 'root_password' => 'puppet'},
template => 'ubuntu_precise',
}

rz_policy { $name:
ensure => 'present',
broker => 'none',
model => $name,
enabled => 'true',
tags => $rz_tags,
template => 'linux_deploy',
maximum => 1,
}

}

Now it should simply be:

system { 'wiki01.foo.com':
rz_tags => ['virtual'],
}

Would this help?

Nan
Reply all
Reply to author
Forward
0 new messages