Puppet: System Administration Automated

Support

Running Puppet on Solaris

Solaris was an early development target for Puppet, hence Puppet's support for the platform is mature and stable.

Installation

Puppet has Facter and Ruby as prerequisites, neither of which will be found on a stock, default Solaris installation. What follows is a quick walk through of the easiest way to install Puppet on a freshly built Solaris 10 machine. By far the easiest way to install puppet and its dependencies is to use the blastwave (Community Software) archive, aka CSW http://www.blastwave.org. You’ll need the blastwave package management tool, pkg-get, and a working copy of wget. Fortunately, even minimal Solaris builds ship with ftp, and ftp can be used to retrieve these packages. The following assumes you are logged in as root, and are using the bash shell:

cd /tmp
ftp unix.hensa.ac.uk
anonymous
you@yourisp.net
cd sites/blastwave.org
passive
get pkg_get.pkg
get wget-i386.bin
get wget-sparc.bin
quit

Having got these binaries, you’ll need to install them:

pkgadd -d pkg_get.pkg   
mv wget-$(uname -p).bin /opt/csw/bin/wget
chmod +x /opt/csw/bin/wget    
PATH=$PATH:/opt/csw/bin:/opt/csw/sbin

You may want to make these PATH changes permanent.

Once pkg-get is installed you should edit /opt/csw/etc/pkg-get.conf to use a local blastwave mirror. The list of mirrors is here http://www.blastwave.org/mirrors.php: The default mirror is too slow to use. At the moment, Puppet is only available through the unstable tree. Then you can use pkg-get to install puppet, which will pull in all the dependencies.

 pkg-get -U
 pkg-get install puppet

Note that this not only installs puppet, it also turns on the daemon which starts looking for a local puppet master server. To stop this, after installation:

 svcadm disable puppetd

Integrating Puppet with Jumpstart

Solaris 10

post-install script:

#!/bin/sh

### Setup
mkdir /a/jumpstart
mount jumpstartserver:/opt/solaris/jumpstart /a/jumpstart

### Blastwave support
cd /a/jumpstart
cp root.profile /a/.profile
mkdir -p /a/usr/local/bin
cp wget-`uname -p`.bin /a/usr/local/bin/wget
chmod 755 /a/usr/local/bin/wget
mkdir -p /a/opt/csw
echo all | pkgadd -a admin.jumpstart -d pkg_get-3.8.1-all-CSW.pkg -R /a
cp /a/jumpstart/pkg-get.conf /a/opt/csw/etc
cp /a/var/pkg-get/admin-fullauto /a/var/pkg-get/admin

### Ruby from Blastwave
cd /a/jumpstart
mkdir -p /a/usr/local/sbin
cp /a/jumpstart/ruby-install.sh /a/usr/local/sbin
chmod 700 /a/usr/local/sbin/ruby-install.sh
chroot /a /usr/local/sbin/ruby-install.sh

### Facter and Puppet from garylaw.net
cp facter-1.3.8,REV=2007.09.23-SunOS5.8-all-CSW.pkg /a/tmp
cp puppet-0.23.2,REV=2007.09.23-SunOS5.8-all-CSW.pkg /a/tmp
cp admin.jumpstart /a/tmp
cp /a/jumpstart/puppet-install.sh /a/usr/local/sbin
chmod 700 /a/usr/local/sbin/puppet-install.sh
chroot /a /usr/local/sbin/puppet-install.sh

## Puppet setup
cp puppetd.conf /a/etc/puppet
cd /a/var/svc/manifest/network
ln -s ../../../../opt/csw/var/svc/manifest/puppetd.xml .
cd /a/jumpstart

### Teardown
cd /
umount /a/jumpstart
rmdir /a/jumpstart

root.profile

umask 022

PATH=/usr/bin:/usr/sbin:/usr/ccs/bin:/usr/dt/bin:/usr/openwin/bin:/bin:/usr/ucb:/opt/SUNWspro/bin:/usr/local/bin:/usr/local/sbin:/opt/csw/bin:/opt/csw/sbin
export PATH

MANPATH=/usr/man:/usr/dt/man:/usr/openwin/share/man:/usr/local/man:/opt/SUNWspro/man:/opt/csw/man
export MANPATH

PS1="`whoami`@`hostname`# "
export PS1

admin.jumpstart

mail=
instance=unique
partial=nocheck
runlevel=nocheck
idepend=nocheck
rdepend=nocheck
space=nocheck
setuid=nocheck
conflict=nocheck
action=nocheck
basedir=default

pkg-get.conf

url=http://www.gtlib.gatech.edu/pub/blastwave/unstable

ruby-install.sh -- pkg-get running inside a chroot requires a working mnttab, and openssl (one of the Ruby dependencies) requires a working /dev/random and /dev/urandom. On my Solaris 10 Jumpstart installs, /dev/random and /dev/urandom exist in the chroot, but are symlinks to missing entries in /devices.

#!/bin/sh

/sbin/mount -F mntfs mnttab /etc/mnttab
mknod /devices/pseudo/random@0:random c 190 0
mknod /devices/pseudo/random@0:urandom c 190 1

PATH=$PATH:/usr/local/bin:/usr/local/sbin:/opt/csw/bin:/opt/csw/sbin
export PATH
pkg-get install ruby

puppet-install.sh -- these installs might not require a chroot, and may work fine if installed similar to the pkg-get installation above.

#!/bin/sh
/sbin/mount -F mntfs mnttab /etc/mnttab
cd /tmp
mkdir /etc/puppet
echo all | pkgadd -a admin.jumpstart -d \
        facter-1.3.8,REV=2007.09.23-SunOS5.8-all-CSW.pkg
echo all | pkgadd -a admin.jumpstart -d \
        puppet-0.23.2,REV=2007.09.23-SunOS5.8-all-CSW.pkg

puppet.conf

[puppetd]
# Make sure all log messages are sent to the right directory
# This directory must be writable by the puppet user
logdir=/opt/csw/var/puppet/log
vardir=/opt/csw/var/puppet
rundir=/opt/csw/var/puppet/run
server=puppetserver.domain
factsync=true

Simple Puppetmaster install and configuration

To do

Puppet on older versions of Solaris

Of course, blastwave will only work on Solaris 8+. However, Puppet does work well with the Ruby from sunfreeware for at least Solaris 2.6 and 7, and people have even had success compiling pkg-get for use with those platforms by pointing it to the sunfreeware repository - however, your mileage may vary with that (not tested by the person writing this paragraph). Certainly, using sunfreeware packages and native sun packages on their own works quite well.