If you’ve gone through the tutorials on how to get started with Razor and Puppet that I’ve posted earlier (see here for the first part of five) you should have a Razor and Puppet installation already up and going. For this tutorial series I’d like to show you how to manage your Razor configurations with Puppet, making it less dependent on commandline and more easily manageable.
First, let’s look at installing Razor through Puppet. A manual variant of doing this was already covered in the first part of the Razor and Puppet howto, but as we’re moving into managing everything automatically through Puppet let’s go through a cleaner and more repeatable way of doing it. For this to work you’ll already need to have a working Puppet installation up and running (explained in my previous howtos, but basically what you need is Puppet installed with autosigning of certificates enabled (unsafe for production environments but fine for testing)). I am assuming you are root or using sudo in front of every command.
First, install the Razor module:
puppet module install puppetlabs-razor
Then open up your /etc/puppet/manifests/nodes.pp (or any other file where you’re managing your node config, like site.pp) and add this into it:
node puppet { class { 'sudo': config_file_replace => false, } include razor }
Of course, make sure that the nodename (here called “puppet”) matches your Razor server name. Now run the puppet agent (command: “puppet agent -t”) on the machine you’ve defined above and watch the magic happen as Razor get’s automagically installed! This way, when you’ll update the Razor module as a new version gets released everything will be updated on your Razor node as well. Sweet!
Another thing we did previously was to install DNSmasq for DHCP and DNS functionality, and we managed it manually through a single configuration file. For more of the specific settings in the DNSmasq config please see this post. Let’s clean that up a bit as well, and use the following settings to get DNSmasq up and running properly using a proper Puppet configuration:
puppet module install saz-dnsmasq
Then add the following into your node definition:
node puppet { class { 'sudo': config_file_replace => false, } include razor dnsmasq::conf { 'another-config': ensure => present, content => "dhcp-range=192.168.72.100,192.168.72.150,12h\ndhcp-boot=pxelinux.0\ndhcp-option=3,192.168.72.2\ndhcp-option=6,192.168.72.130\ndomain=purevirtual.lab\nexpand-hosts\ndhcp-host=puppet,192.168.72.130\nserver=8.8.8.8\n", } }
Run “puppet agent -t” again on your Razor server and watch DNSmasq getting installed and ready to use for all your deployment needs.
So, instead of doing it all manually you now have a complete Puppet node configuration for your present and current Razor installation needs, awesome
Next post will cover defining images, models, policies and brokers using Puppet.
