The autostow is Dead, Long Live stowedpackage!

I had posted earlier about distributing stowed packages via rsync and puppet to my managed systems, but that method wasn’t quite what I wanted:

  1. There was one more file to manage outside my regular puppet manifests, and I’d have to remember to keep them both up to date and in sync.
  2. There wasn’t an easy way of ensuring that other versions of a particular package got unstowed before deploying out the desired version.
  3. The entire stow tree would be copied out to every system, regardless of whether OpenMPI was a good fit for the web server.

So, here’s my new method:

  1. Keep my same metastow module loaded on the rsync server. The metastow module contains one top-level directory per puppet architecture (i686, x86_64, etc.). Each of those architecture folders is a stow tree containing every stowed package for that architecture.
  2. Add a stowedpackage definition to my puppet manifests as follows:
    define stowedpackage ( $basepackage, $version,
        $stowdestdir='/usr/local/stow' ) {
        file { "stow-initiator_${basepackage}-${version}":
            source => "puppet:///files/stow-initiator_${basepackage}-${version}",
            path   => "/etc/puppet/stow-initiator_${basepackage}-${version}",
        exec { download:
            command     => "/usr/bin/rsync -a --delete ${rsyncserver}::${rsyncmodule}/${hardwaremodel}/${basepackage}-${version} ${stowdestdir}",
            refreshonly => true,
            subscribe   => File["stow-initiator_${basepackage}-${version}"],
            alias       => "download_${basepackage}-${version}"
        exec { unstow-others:
            command     => "cd ${stowdestdir} && stow --delete ${basepackage}-*",
            refreshonly => true,
            subscribe   => Exec["download_${basepackage}-${version}"],
            alias       => "unstow-others_${basepackage}-${version}"
        exec { stow:
            command     => "cd ${stowdestdir} ; stow ${basepackage}-${version}",
            refreshonly => true,
            subscribe   => Exec["unstow-others_${basepackage}-${version}"]
  3. Use the stowedpackage definition in other parts of my manifests:
    # Create OpenMPI installation and configuration.
    class openmpi {
        stowedpackage {
  4. Add a trigger file to the puppetmaster’s /etc/puppet/files folder:
    /etc/puppet/files# date > stow-initiator_openmpi-1.0.1

Join the Conversation

1 Comment

Leave a comment

Your email address will not be published. Required fields are marked *