Ask Your Question

How can I use Puppet to build from source?

asked 2012-11-13 12:30:41 -0600

haus gravatar image

I have a webserver and I want to download, unpack, configure and compile and install apache. How can I get Puppet to do this for me only once?

edit retag flag offensive close merge delete

6 Answers

Sort by » oldest newest most voted

answered 2012-11-28 13:58:28 -0600

gh gravatar image

While you could have a series of exec{} resources that each check that the commands need to be run have been run and build relationships between them for ordering, you do not want to go down that road.

All software installed on a system should be done through that OS's packaging software, not through compilation. Then you can just use a package{} resource. This also gives you the benefit of leveraging the packaging software that acts as a source of truth for installed packages and generally knows the files on disk for each package.

If you want to custom ... (more)

edit flag offensive delete link more

answered 2012-12-19 05:58:58 -0600

updated 2012-12-19 06:07:48 -0600

Confirming what others have said about package management, if you need to download, extract and install a tarball for whatever reason, (Installation of apache from source, installation of a web app, installation of a custom app) with Puppet you might find interesting the this define, that has been done exactly for this purpose:

To use it in a Manifest:

  • Have puppi in your modulepath

  • Write something like (not tested):

    puppi::netinstall { 'apache':
      url                 => '',
      destination_dir     => '/var/tmp/apache', # Must Exist ...
edit flag offensive delete link more

answered 2012-12-18 15:17:28 -0600

reidmv gravatar image

Using native packages is almost always the sanest way to go, as other answers suggest. That said, Puppet as a framework is capable of supporting build-from-source style application deployments.

A generic stub of what a defined type for building from source might look like:

The gist is unfinished and most notably does not include "unless" statements or refreshonly parameters, but gets the idea across in a simple way.

edit flag offensive delete link more

answered 2012-12-18 08:59:31 -0600

bmurts gravatar image

updated 2012-12-18 13:49:13 -0600

To follow up Garrett's post, it is the recommended method to utilize the OS's built-in package manager to help with consistency, updates, etc. but it can be done.

Currently, in my Ruby module I'm compiling from source for the YAML library and actual Ruby v1.9.3. It is not ideal and I hope to switch to a package for easier management, but currently I'm following the word passed down from those with the higher pay grade.

To give you an idea what I went through (which could probably use some refactoring as I get better ... (more)

edit flag offensive delete link more


if you compile in Exec[] resource, you might need to increase timeout, default is 5 minutes, which turned out to be not sufficient for us to compile ruby on some ...(more)

asq gravatar imageasq ( 2012-12-18 11:18:53 -0600 )edit

@asq, correct. I manually override the timeout parameter in my 'ruby_make' Exec and set it to '0' to disable the default timeout @ line 61 in my gist

bmurts gravatar imagebmurts ( 2012-12-18 13:48:08 -0600 )edit

If you want to custom compile software and building packages seems like a lot of overhead, check out FPM[1]. It lets you easily take a directory and convert it into a versioned package. Thanks

googleclone gravatar imagegoogleclone ( 2016-08-05 05:45:45 -0600 )edit

answered 2012-12-18 15:00:21 -0600

riffraff169 gravatar image

updated 2012-12-18 15:01:35 -0600

There is a staging module puppet-staging: that will do some good stuff. I am currently using it to deploy tomcat7 from tar.

But again, native packaging is best.

edit flag offensive delete link more

answered 2012-12-19 03:04:18 -0600

In addition to @gh's answer, I'd say if you really want to build software on your machines, you should use a source-based distribution, such as Gentoo, instead of a binary-based distribution like Debian/Ubuntu/RedHat… Then you could use the portage provider for the package type.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2012-11-13 12:30:41 -0600

Seen: 9,777 times

Last updated: Dec 19 '12