How to Install Packages from Source Code with Puppet

configuration-managementpuppet

I'd like to install source code packages which doesn't have binary packages (deb, rpm) yet.

How do I stop execution of a module in case that the module is already install on that machine?

I'm using:

  Exec {
    creates => "${zookeeper_path}/zookeeper/bin/zkServer.sh"
  }

however all the other block are executed anyway. What is the best way? Checking existence of several files? I don't want to untar and recompile all the modules when puppet check for changes.

EDIT:

The installation process consists of several steps:

  1. fetch tar.gz package
  2. untar package
  3. create several config files
  4. create service
  5. ensure service is running

Best Answer

After trying few dead-ends and from @Mike Renfro comments I came up with following steps (feel free to improve it):

  1. Don't install packages from source code with Puppet (it takes too long and brings too many problems)

  2. Always create binary packages. It can be easily redistributed and tested.

  3. Set up your own repository - for Debian a good choice is reprepro, documentation seems to be awful, but there's a Puppet module for installing: puppet-reprepro. Adding new package is quite easy:

    $ reprepro -Vb . includedeb squeeze ~/packages/my_package.deb

  4. Create new packages with fpm. The process of building a package is surprisingly simple and much easier than writing it in Puppet script.

  5. Install packages simply with:

    package { "leiningen": ensure => present }

  6. You can simply get packages which are still in testing version deploy it with your local repository.

  7. Use hiera for machine-specific configuration, in manifests should be only generally reusable templates for certain tasks (like web-server, db-server, etc.)
Related Topic