Smoothwall Firewall project

Showing posts with label puppet. Show all posts
Showing posts with label puppet. Show all posts

Tuesday, 9 April 2013

Using an External Node Classifier in a masterless configuration with Puppet


I use standalone puppet a lot for managing my own machines and cloud servers, but the site.pp file was starting to grow large and it became obvious the solution was to use an external node classifier or ENC.

There is lots of documentation on the web on how to do this with a puppet master/ agent configuration, but nothing I could find on how to do this.

The key change is where you specify the change of node class information in the puppet.conf file. If you follow the puppetlabs documents , it won't work. If however you put the new ENC definition into the [main] section , it works just fine. Only a minor change , but it will not work unless you do.

The code you need looks like this:


node_terminus = exec
external_nodes = /usr/local/bin/node_classifier.py

The node classifier can be whatever you want, but I used python just to get it up and running quickly for testing.


I hope this saves someone hours of hunting around to get this sorted.

During my research , I have also found that it should be possible in the latest releases to use Hiera as your ENC to generate the YAML required. Next on my list to try.

Link to Puppet Labs ENC documentation

Using Hiera as your ENC

Wednesday, 15 August 2012

Using puppet with Virtualbox to speed up client additions install


One of the first things you need to do when you create a new VM is install the client additions code, which offers enhanced networking,screen sizing, cut & paste and general host/client integration. With Centos 6.3 Live CD installs , several of the needed rpm packages that allow the install are missing.

I have a puppet master installed and configured - which is beyond the scope of this post - but if you need help doing that, then just buy or download the Pro Puppet book, which covers this topic very clearly for any operating system.

Pro Puppet book

Make sure every machine can resolve all DNS entries properly , either with a DNS server or by hosts files - if you must. Every machine needs to resolve puppet.mynetwork.com and puppet.

You also need to install ruby , ruby-libs ,ruby-shadow , puppet and facter or you won't be able to connect to the puppet master in the first place. You can do this as part of your post-install kickstart or manually. You will also need to add the Fedora mainatained EPEL repo to get the latest versions of these.

The important elements that you need to install are make, gcc and kernel-devel and I also always add vim.

You need to define each of these in the modules sections under /etc/puppet/modules  on the puppet master with their own directory structure of:

/etc/puppet/modules/make/files
/etc/puppet/modules/make/manifests
/etc/puppet/modules/make/templates

Within the manifests directory you need to add an init.pp, and for vim it will look like this:


class vim {
package { vim-enhanced:
ensure => present,
}
}


You can obviously do a lot more in these files, but this is just to show what is needed for this task.

You also need to make sure you include these modules in the node.pp file in the /etc/puppet/manifests directory. Like this:


node /^testmac\d+\.mynetwork\.com/ {
        include vim
        include make
        include kernel-devel
        include gcc
}

The guest server in my environment follows this naming scheme and the regular expressions allow you to have as many as you like.

To connect your new VM  to the puppetmaster you can run the following command and make sure that  the certificate is allowed on the server:

puppet agent --server=puppet.mynetwork.com --no-daemonize --verbose

Once the client server has the cert's installed correctly, then run this command again to auto install all the rpms needed for you to install the client additions. The client additions can be installed from the GUI or the command line, which ever you prefer.

You can now also manage all your VM's with puppet , and make your virtual dev/test environment a lot easier to manage.