Pulling Strings With Puppet - James Turnbull [8]
So, if we're installing Ruby and its libraries on a Red Hat Fedora host, we need to use its package management system to install the ruby and ruby-libs packages like so:
Installing the Ruby package and libraries may not always install all of the required libraries. If the following base libraries are not installed as part of your base Ruby installation, you may need to selectively install the missing libraries.
• base64
• cgi
• digest/md5
• etc
• fileutils
• ipaddr
• openssl
• strscan
• syslog
• uri
• webrick
• webrick/https
• xmlrpc
The two libraries that are often not packaged with distributions are the Ruby OpenSSL Library and Ruby XMLRPC Library. You can confirm if both these libraries are installed by running the following commands:
If both commands return installed, then both libraries are installed. If they return
where packagename is the name of the package, openssl for example, whose presence is being tested, you will need to install the missing libraries.
Tip - If you want to test for the presence of any library, simply specify the library name as the value of the - r variable in the ruby command.
In Table 2-1, I've also listed, for some distributions, additional packages that are needed to support a Puppet installation. For example, in the case of Debian and Ubuntu, you can install the libopenssl-ruby package to add the Ruby OpenSSL Library and the libxmlrpcruby package to add the Ruby XMLRPC Library.
Caution - Not all packages available are the most up-to-date versions of software. Always check that the version installed is suitable to run any required software and functionality.
Ruby is also available for Sun Solaris and ships with the Solaris 10 Community release (http://www.sun.com/software/solaris/freeware/). For Mac OS X, you can use the MacPorts or FinkCommander applications to install Ruby. Or if your Mac runs the Leopard OS X release, Ruby should be bundled as part of the operating system. It is possible to install Ruby on HP UX, and you can find a port at http://hpux.connect.org.uk/hppd/hpux/Shells/ruby-1.8.4/. Lastly, you can compile Ruby versions later than 1.8.5 on AIX.
Installing Facter
Puppet relies on the Facter tool to provide information about hosts. Facter is also developed by Puppet's developers, Luke Kanies and Reductive Labs, and is written in Ruby. It is a cross-platform Ruby library for returning "facts" about the operating system of a host, for example, IP addresses, operating system versions, and the like. It can be installed from source, or some platforms have a Facter package available. I'll demonstrate both options.
Installing Facter from Source
Facter is available as a source package from the Reductive Labs site at http: //www.reductivelabs.com/downloads/facter/. Download the latest package, release 1.3.8 at the time of writing, and unpack the archive.
Now install the facter binary and libraries using the install.rb script.
You can confirm that Facter is installed and working like so:
This should return the version of the currently installed Facter.
Running facter without any options will return a list of all the facts and their values that are currently available on your host.
Installing Facter from Package
Not all platforms have a Facter package available, but some do. You can install this package with your chosen platform's package management system. Table 2-2 presents a list of all of the platforms with Facter ports or packages available at the time of writing.
Tip - If you install Facter on Debian, you may also want the lsb-release package (if it is not already installed). This package provides Facter with Linux Standard Base facts that help you identify specific Debian and derived distributions. Most other Linux distributions install this package by default, for example, Ubuntu and Red Hat (redhat-lsb).
For example, if you are