Storagebod Rotating Header Image

Razor – An Idiot’s Guide to Getting Started!

My role at work does not really allow me to play with tech very often and unless I have a real target in mind, I’m not as much as an inveterate hacker as I used to be; I generally find a problem, fix a problem and then leave it alone until solution is broken. So I don’t tend to go into any depth on anything but every now and then, I see something and think that’s cool, can I get it to work.

When I saw the new tool from Nicholas Weaver and EMC built on Puppet to configure ‘bare-metal’ machines; I decided that was something cool enough to have a play with. But there were a few problems, I knew what Puppet is but I’d never used it and I really didn’t have a clue what I was doing.

Still, I followed the links to the documentation and started to hack; after a couple of failed attempts due to missing prerequisites, I decided to be a bit more methodical and document what I was doing.

So this is what I did…more or less. And hopefully this might be helpful to someone else. I am assuming a certain amount of capability tho’! So more an Idiot Savant than just an Idiot.

I have a number of core services already running at home; I have my own internal DNS and DHCP server running on Ubuntu, I have a couple of NAS servers and a couple of machines running ESX5i.

All the documentation for Razor is based around Ubuntu Precise Pangolin 12.04; so first thing to do was to build a Precise VM on one of the ESX5i boxes. This was provisioned with 2 Gigs and 2 virtual cores.

1) Install Ubuntu 12.04 Server and I always do an OpenSSH Server build at installation; I leave everything else to after I’ve done a base install.

2) I added a static assignment for the server in my DHCP box and created a DNS entry for it.

3) After the server was installed, I did my normal ‘break all the security’ and used sudo to set a root password and allow myself to log directly on as root. I’m at home and can’t be bothered to use sudo for everything.

4) I started installing packages, I’m not sure whether the order matters but this the order I did things and all this was done as root

EDIT:According to Nick and he should know, the Razor module installs Node and Mongo-db automagically…I had some problems the first couple of times and decided to do it myself, this is possibly because I’m an extremely clever idiot and break idiot proof processes.

Node.JS

apt-get install nodejs npm

MongoDB

I didn’t use the standard packaged version and pulled down the package from mongodb.org

apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
vi /etc/apt/sources.list
Added deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen
apt-get update
apt-get install mongodb-10gen

Puppet

Yet again I didn’t use the standard packaged version and pulled down from puppetlabs.com

wget http://apt.puppetlabs.com/puppetlabs-release_1.0-3_all.deb
dpkg -i puppetlabs-release_1.0-3_all.deb
apt-get update
apt-get install puppetmaster

Ruby 1.9.3

Note that the above install does install Ruby but appears to bring down Ruby 1.8; Razor wants a later version.

apt-get install ruby1.9.3

This seems to do what you want!

At this point you should be in the position to start installing Razor.

Razor

This is very much cribbed from the Puppet Labs page here

puppet module install puppetlabs-razor

chown -R puppet:puppet /etc/puppet/modules

puppet apply /etc/puppet/modules/razor/tests/init.pp --verbose

This should run cleanly and at this stage you should have some confidence that Razor will probably work.

/opt/razor/bin/razor

This shows that it does work.

/opt/razor/bin/razor_daemon.rb start

/opt/razor/bin/razor_daemon.rb status

This starts the razor daemon and confirms it is running. Our friends at PuppetLabs forgot to tell you start the daemon, it’s kind of obvious I guess but made this idiot pause for a few minutes.

Configuring Your DHCP Server

I run my own DHCP server based and this needed to be configured to point netbooting servers at the Puppet/Razor server.

I amended the /etc/dhcp/dhcp.conf file and added the following

filename "pxelinux.0";
next-server ${tftp_server_ipaddress};

in the subnet declaration.

At this point, you should be ready to really start motoring and it should be plain sailing I hope. Certainly this idiot managed to follow the rest of the instructions for Example Usage on Puppetlabs.

Of course now I’ve got lots of reading to do around Puppet and the likes but at the moment, it does appear to work.

So great work Nick and everyone at EMC.


One Comment

  1. Andi says:

    Thanks for you great instructions, i followed them on a clean ubuntu 12.04 server install. I did not install mongoDB and node.js as i wanted to see if it works automagically or not.

    There are some errors in the scripts:
    puppet apply /etc/puppet/modules/razor/tests/init.pp –verbose

    err: Removing mount files: /etc/puppet/files does not exist or is not a directory

    err: /Stage[main]/Mongodb/Service[mongodb]: Could not evaluate: Execution of ‘/sbin/initctl –version’ returned 1: initctl: invalid command: –version
    Try `initctl –help’ for more information.

    warning: /Stage[main]/Razor/Service[razor]: Skipping because of failed dependencies

    so the first error is not a problem, probably just a failure of the puppet install in ubuntu. it can be solved by adding:
    mkdir /etc/puppet/files
    chown puppet:puppet /etc/puppet/files

    the second error is described here: http://projects.puppetlabs.com/issues/15029
    so if i remove the space in front of –version on the described script, it seems this problem is fixed, but i hit then another one:

    err: /Stage[main]/Mongodb/Service[mongodb]: Could not evaluate: Invalid version string ‘1.5’!

    1.5 is the version initctl returns:
    initctl –version
    initctl (upstart 1.5)

    now i’m a bit lost, i’m not shure if they really wan’t to test for the initctl version here, but i have no idea where to look further.

    can someone point me in a direction?

Leave a Reply

Your email address will not be published. Required fields are marked *