| Version 18 (modified by sisteczko, 3 months ago) |
|---|
Using Puppet From Source
Puppet is currently implemented in Ruby and uses standard Ruby libraries. You should be able to run Puppet on any Unix-style host with Ruby. Windows support is planned but not currently available.
Before you Begin
Make sure your host has Ruby version 1.8.2 or later:
$ ruby -v
and, if you want to run the tests, rake:
$ rake -V
While Puppet should work with 1.8.1, there have been many reports of problems with this version.
Make sure you have Git:
$ git --version
Get the Source
Puppet currently relies on another Reductive Labs tool, Facter. Create a working directory and get them both:
$ SETUP_DIR=~/git $ mkdir -p $SETUP_DIR $ cd $SETUP_DIR $ git clone git://github.com/reductivelabs/facter $ git clone git://github.com/reductivelabs/puppet
You will need to periodically run:
git pull origin
From your repositories to periodically update your clone to the latest code.
If you want access to all of the tags in the git repositories, so that you can compare releases, for instance, do the following from within the repository:
$ git fetch --tags
Then you can compare two releases with something like this:
$ git diff 0.23.1 0.23.2
Most of the development on puppet is done in branches based either on features or the major revision lines. Currently the "stable" branch is 0.24.x and development is in the "master" branch. You can change to and track branches by using the following:
git checkout --track -b 0.24.x origin/0.24.x
Tell Ruby How to Find It
Last, we need to put the puppet binaries into our path and make the Puppet and Facter libraries available to Ruby:
$ PATH=$PATH:$SETUP_DIR/facter/bin:$SETUP_DIR/puppet/bin $ RUBYLIB=$SETUP_DIR/facter/lib:$SETUP_DIR/puppet/lib $ export PATH RUBYLIB
Facter changes far less often than Puppet and it is very minimal (a single library file and a single executable), so it is probably worth just installing it:
$ cd facter $ sudo ruby ./install.rb
Platform-specific notes
Ubuntu 8.04
Ubuntu 8.04 has some unique packages other non-LTS Ubuntus don't have (like support for openvz). Unfortunately it is quite old distribution and the puppet that comes with it is quite old (v. 24.4) . Here goes step-by-step description how to get puppet, facter and puppetmaster running, together with stored configuration (right now sqlite3 only) and augeas (not finished)
STEP 1 - getting the packages
# aptitude install ruby libopenssl-ruby rdoc puppetmaster rails sqlite libshadow-ruby1.8 Note, that it installs puppetmaster also. It is required, because the install script sets the puppet directories correctly. # aptitude purge puppetmaster Of course we don't need the old puppetmaster, we just needed the directories to be set.
STEP 2 - getting the source
It assumes that the git-core package is installed on the system
# git clone git://github.com/reductivelabs/puppet # git clone git://github.com/reductivelabs/facter
STEP 3 - installing the packages
The installation procedure sets both puppet and puppetmaster. If we are not interested in puppetmaster, then we need to delete it manualy after the installation. The order of execution matters, since puppet depends on facter.
# cd facter # ./install.rb # cd ../puppet # ./install.rb # cd .. # rm -R facter # rm -R puppet
STEP 4 - Stored configs.
Theese steps are needed to be performed only on server (puppetmaster). Installation requires ruby gem to fetch additional packages. Unfortunately at the time of writing there are some server problems with gem repositiories, so until they are fixed the following steps brake at the moment of using gem.
# aptitude install ruby rubygems ruby1.8-dev libsqlite3-dev # gem update --system
The last command needs about 600MB of free RAM(!), so if one runs it on virtual machine, be sure to grant enough memory, otherwise the command will take ages and tear down the hardrive from excessive paging.
Next thing is to edit the /usr/bin/gem file, so we will not get /usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError). We need to insert
require 'rubygems/gem_runner'
after the require 'rubygems' statement just in the beginning of the file, so first lines of /usr/bin/gem look like this:
require 'rubygems' require 'rubygems/gem_runner' #Gem.manage_gems
(this specific step is taken from http://railsforum.com/viewtopic.php?pid=48963)
After that we need to install
# gem install rails # gem install sqlite3-ruby
Now all prerequisities are in place and all is left to do is to configure puppet itself: Add to /etc/puppet/puppet.conf:
storeconfigs = true dbadapter = sqlite3 dblocation = /var/lib/puppet/storeconfigs.sqlite
or anything similar.
STEP 5. Augeas
As of version 0.25.1 Puppet lacks native file editing capabilities. Augeas (Puppet Auges?) is a specialized third-party tool written specifically for this task. To say the truth one can do well without the augeas using custom functions or even custom resource types, but that requires some degree of skills in ruby and knowledge of puppet internals. (Well, one can also do without puppet itself, using custom written functions... but why reinvent a wheel?)
Of course we need augeas only on client.
Unfortunately augeas is not present in Hardy's repositories, but the good news is that it is quite straightforward to backport it. Once we have the backported packages:
augeas-lenses_0.5.1-1ubuntu1_all.deb augeas-tools_0.5.1-1ubuntu1_i386.deb libaugeas0_0.5.1-1ubuntu1_i386.deb libaugeas-ruby1.8_0.2.0-2ubuntu2_i386.deb libaugeas-ruby_0.2.0-2ubuntu2_all.deb
all we need to do is to put them (and only them) in one directory and execute {{{dpkg -i *.deb apt-get -f install }}}
Preparing backports of augeas
The following steps will install tons of building-related packages. Because the only things we need are 5 .dep packages, one would prefer doing the following steps in virtual, easily discradable environment.
First one have to change line from deb-src http://archive.ubuntu.com/ubuntu hardy main restricted into deb-src http://archive.ubuntu.com/ubuntu karmic main restricted in file /etc/apt/sources.list
After that we need to apt-get update
Then we need to do the actual backporting:
apt-get install devscripts apt-get build-dep augeas apt-get source augeas cd augeas-0.5.1 debuild -i -us -uc -b cd .. dpkg -i *.deb
The last command is needed to meet dependencies of the next build:
apt-get build-dep libaugeas-ruby apt-get source libaugeas-ruby cd libaugeas-ruby-0.2.0/ debuild -i -us -uc -b cd .. dpkg -i *.deb cd ..
Now, in current directory we have all 5 .deb packages, which are used to install augeas.
