Self Contained Puppet Installation and RPM Distribution

I needed a self contained puppet installation running the latest version of Ruby. I also wanted to distribute it through RPM files.

Dependencies

yum install openssh-clients gcc openssl-devel rpm-build rubygems
gem install fpm

libyaml

wget http://pyyaml.org/download/libyaml/yaml-0.1.5.tar.gz
./configure --prefix=/opt/mypuppet
make; make install

Ruby


wget http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p481.tar.gz
./configure --prefix=/opt/mypuppet --enable-shared --with-opt-dir=/opt/mypuppet --disable-install-doc --enable-rpath
# make; make install

Puppet, facter and hiera
Facter


# wget http://downloads.puppetlabs.com/facter/facter-1.7.6.tar.gz
http://downloads.puppetlabs.com/facter/facter-2.2.0.tar.gz
# /opt/mypuppet/bin/ruby install.rb

Hiera


# wget http://downloads.puppetlabs.com/hiera/hiera-1.3.1.tar.gz
http://downloads.puppetlabs.com/hiera/hiera-1.3.4.tar.gz
# /opt/mypuppet/bin/ruby install.rb --configdir=/opt/mypuppet/etc

Puppet

# wget http://downloads.puppetlabs.com/puppet/puppet-3.4.2.tar.gz
wget http://downloads.puppetlabs.com/puppet/puppet-3.6.2.tar.gz
# /opt/mypuppet/bin/ruby install.rb --configdir=/opt/mypuppet/etc

As long as the bug PUP-1567 is not fixed, you need to apply the following patch, to make “puppet apply” work with the alternate installation directory.


puppet-masterless.patch

--- /opt/mypuppet/lib/ruby/site_ruby/1.9.1/puppet/util/run_mode.rb 2013-12-26 18:48:18.000000000 +0100
+++ /opt/mypuppet/lib/ruby/site_ruby/1.9.1/puppet/util/run_mode.rb.mz 2014-01-25 15:46:47.025501551 +0100
@@ -55,11 +55,11 @@

class UnixRunMode < RunMode
def conf_dir
- which_dir("/etc/puppet", "~/.puppet")
+ which_dir("/opt/mypuppet/etc", "~/.puppet")
end

def var_dir
- which_dir("/var/lib/puppet", "~/.puppet/var")
+ which_dir("/opt/mypuppet/var", "~/.puppet/var")
end
end
 

FPM


fpm -s dir -t rpm -n mypuppet -v 3.6.2 -C /opt/mypuppet .

Don’t forget the . at the end of FPM, it’s important!

The inspiration and most of the directions is from  here.