Managing Razor provisioning with Puppet – Part 2

puppet plus razor is good

So we went through Puppet configuration of deploying a functional Razor installation in the first part here.

Now let’s look into how we can get Puppet to manage our Razor environment, namely models, images, policies and brokers. For this we’re gonna start off with configurations for deploying the Debian Wheezy distribution and then go on to Ubuntu Precise.

Open up your Puppet node configuration (site.pp or similar) for your Razor deployment and add the following within your “node puppet” definition that we defined in Part 1:

rz_image { "debian_wheezy":
  ensure => present,
  type => 'os',
  version => 'beta4',
  source => "",

Run “puppet agent -t” and you should see the following output:

Info: Applying configuration version '1355082848'
 Downloading rz_image from ...
 /Stage[main]//Node[puppet]/Rz_image[debian_wheezy]/ensure: created

Ok, so something got applied, now let’s run the following to verify that it worked:

root@puppet:~# razor image
UUID => 2RdsxhDxOvnNii39AY3h56
Type => OS Install
ISO Filename => mini.iso
Path => /opt/razor/image/os/2RdsxhDxOvnNii39AY3h56
Status => Valid
OS Name => debian_wheezy
OS Version => beta4

Look at that! Automatic ISO download and image injection into Razor. Let’s keep going and add a model for Debian Wheezy as well:

rz_model { 'install_wheezy':
  ensure => present,
  description => 'Debian Wheezy',
  image => 'debian_wheezy',
  metadata => {'domainname' => 'purevirtual.lab', 'hostname_prefix' => 'debian-', 'root_password' => 'password'},
  template => 'debian_wheezy',

Run your Puppet agent again and this is what you should see:

Info: Applying configuration version '1355083415'
 /Stage[main]//Node[puppet]/Rz_model[install_wheezy]/ensure: created

Let’s verify that as well:

root@puppet:~# razor model
 Label Template Description UUID
 install_wheezy linux_deploy Debian Wheezy Model 4EBOggCnQG90P4qBUNT4zI

Now we’re getting somewhere!

Let’s define our broker (meaning what we’ll hand off to after OS provisioning is done, here we’ll use our Puppet installation) before we go further:

rz_broker { 'puppet_broker':
  ensure => present,
  plugin => 'puppet',
  servers => [ 'puppet.purevirtual.lab' ]

Apply the broker configuration using “puppet agent -t”:

Info: Applying configuration version '1355084448'
/Stage[main]//Node[puppet]/Rz_broker[puppet_broker]/ensure: created

After applying it, let’s verify it:

root@puppet:~# razor broker
Broker Targets:
Name Description Plugin Servers UUID Version
puppet_broker puppet_broker puppet [puppet.purevirtual.lab] 6jvJa0SsZYt0vUEQzusb8y Default

Let’s create a Razor tag as well, shall we? Just to make sure that only the VMs with the correct hardware requirements gets installed with Debian Wheezy. Let’s call it.. hmm.. “halfagigofram”!

rz_tag { "halfagigofram":
  tag_label => "halfagigofram",
  tag_matcher => [ {
    'key' => 'mk_hw_mem_size',
    'compare' => 'equal',
    'value' => "512MiB",
  } ],

Apply it…

Info: Applying configuration version '1355084532'
 /Stage[main]//Node[puppet]/Rz_tag[halfagigofram]/ensure: created

And verify it!

root@puppet:~# razor tag
 Tag Rules
 Name Tags UUID Matchers [count]
 halfagigofram halfagigofram UHIdK6YlezPUnfevHtebY 1

Now let’s create a new Razor policy using everything we’ve done so far:

rz_policy { 'wheezy_policy':
  ensure => present,
  broker => 'puppet_broker',
  model => 'install_wheezy',
  enabled => 'true',
  tags => ['halfagigofram'],
  template => 'linux_deploy',
  maximum => 10,

Last apply for today:

Info: Applying configuration version '1355084748'
 /Stage[main]//Node[puppet]/Rz_policy[wheezy_policy]/ensure: created

Verify the last part as well:

root@puppet:~# razor policy
# Enabled Label Tags Model Label #/Max Counter UUID
2 true wheezy_policy [halfagigofram] install_wheezy 1/10 1 4eAaj0CxKdQNtYD3SmDxk8

Let’s try it out! Boot up a VM with half a gig of ram (512MB for those who can’t process words) and see the magic happen:

root@puppet:~# razor node
 Discovered Nodes
 UUID Last Checkin Status Tags
 7JHPaRlWkrmph5w8jdbvBw 3 sec A [halfagigofram,onlyonedisk,IntelCorporation,memsize_512MiB,cpus_1,vmware_vm,nics_1]

DONE! You now have a proper Puppet configuration for a Razor deployment of Debian Wheezy which will automatically get connected to Puppet after OS provisioning is complete, to do more interesting further application deployments. If you wonder if your node really got #puppetized, just do the following:

On the newly installed node:

cat /etc/puppet/puppet.conf
certname = <LONG UUID>

On the Puppet server run:

puppet cert list --all

And verify that you actually see the certname UUID there as well with a “+”-sign in front of it, meaning it’s signed and ready to rock!

Ok, so some of you might wonder how a Ubuntu variant of this would look like (as I was using Ubuntu is all my previous examples). Well, it would look something along these lines:

rz_image { "ubuntu_precise":
  ensure  => present,
  type    => 'os', 
  version => '12.04.1',
  source  => "",

rz_model { 'install_ubuntu':
  ensure => present,
  description => 'Ubuntu Precise',
  image => 'ubuntu_precise',
  metadata => {'
    domainname' => 'purevirtual.lab', 'hostname_prefix' => 'ubuntu-', 'root_password' => 'password'},
  template => 'ubuntu_precise',

rz_policy { 'precise_policy':
  ensure  => present,
  broker  => 'puppet_broker',
  model   => 'install_ubuntu',
  enabled => 'true',
  tags    => ['memsize_1GiB'],
  template => 'linux_deploy',
  maximum => 10,

Run “puppet agent -t” once again to get everything set up:

Info: Applying configuration version '1355164222'
 Downloading rz_image from ...
 /Stage[main]//Node[puppet]/Rz_image[ubuntu_precise]/ensure: created
 /Stage[main]//Node[puppet]/Rz_model[install_ubuntu_precise]/ensure: created
 /Stage[main]//Node[puppet]/Rz_policy[ubuntu_precise_policy]/ensure: created

At last, verify it by checking “razor image”, “razor model” and “razor policy”. Now you have not just one but TWO operatingsystems ready to be deployed, well done you!

Please let me know in the comments how it worked out for you and what distributions you’ve deployed using this method. Enjoy 🙂


About Jonas Rosland

Open Source Community Manager at VMware
This entry was posted in Automation, EMC, How to, Installation, IT Transformation, Puppet, Razor and tagged . Bookmark the permalink.

5 Responses to Managing Razor provisioning with Puppet – Part 2

  1. Alex-ZL says:

    Really helpful guide, thank you for the sharing.
    I got a silly question: how to trigger the provision( install OS to bare metal) after I have got everything ready, I mean image, model, node, policy are all ready as you referred in the essay.

    • Jonas Rosland says:

      Hi Alex, sorry for the late reply. If your policies are setup correctly, all you need to do is boot up your server. Let me know if you need more help.

  2. Stephen Wallace says:


    GREAT article. Lots of help!

    I found the syntax needs to be updated when using puppet to create the broker config as below. “server = blah” no longer valid.

    rz_broker { ‘puppet_broker’:
    ensure => present,
    plugin => ‘puppet’,
    metadata => {
    version => ‘3.0.2’,
    servers => [ ‘puppet.domain.local’ ],

    More info to be found here –

  3. Stephen Wallace says:

    Wow…I take it back. This one’s a slippery so-n-so. More updates to the syntax, apologies! Try this one on for size……

    rz_broker { ‘puppet_broker’:
    ensure => present,
    plugin => ‘puppet’,
    metadata => {
    broker_version => ‘3.1.1’,
    server => ‘’,

    root@razor:/etc/puppet/manifests# razor broker 3i19JHLssdKYldbKykzo34
    Name => puppet_broker
    Description => puppet_broker
    Plugin => puppet
    UUID => 3i19JHLssdKYldbKykzo34
    Server =>
    Broker Version => 3.1.1


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s