I'd like to be able to override or set a variable from the command line.  Is
this possible?  The only discussion I've been able to stumble upon is this
feature/issue: http://projects.puppetlabs.com/issues/1411

My use case is the following:

I have a specific version of an artifact installed in my PRD environment.
 The version number is set in the recipe.  The artifact is a simple tgz
which is downloaded from our continuous integration server, unpacked and
symlinked.

In my TST environment I'd like a continuous integration server to kick off a
puppet run after a change is made and pass in the latest version of the
artifact just built. This does highlight one aspect of our puppet
installation which may be different than most -- we do not run puppet
daemons on each server which wake up at regular intervals, query
puppetmaster and apply changes but instead we trigger the updates when
needed through a capistrano task.

The pertinent recipe snippets look like:

class logmaster {

  $download_dir = "/scratch"

  $prg = "logmaster"

  $prg_version = "2.0.16622.25"

  $prg_tarball = "$prg-$prg_version-install.tar.gz"

  $prg_dir = "$prg-$prg_version"

  $download_url = "
> http://buildserver:8080/teamcity/httpAuth/repository/download/bt34/.lastPinned/$prg_tarball
> "

  $install_dir = "/opt"

  $installed = "$install_dir/$prg_dir"

  $linked = "$install_dir/$prg"

  ...



  exec { "DownloadLogmaster":

    cwd     => "$download_dir",

    command => "wget $download_url",

    creates => "$download_dir/$prg_tarball",

  }



  exec { "InstallLogmaster":

    cwd       => "$download_dir",

    logoutput => true,

    command   => "tar -zxvf $prg_tarball;  mv $prg_dir $install_dir; chown
> -R logmaster:logmaster $installed; ln -s $installed $linked",

    creates   => "$install_dir/$prg_dir",

    require   => Exec["DownloadLogmaster"],

  }

...

}



This install method feels a little hackish and I know it might be
cleaner/easier to package as an RPM or deb file but we have a lot more
developer knowledge than sysadmin knowledge in-house and we're slowly taking
that plunge and I'd welcome other suggestions on how people install simple
tgz files.  But it seems even with RPM I'd have the same problem that I'd
specify a version in the ensure attribute of the package to ensue PRD has
that version but when running against TST I'd want it to be overridden to be
latest or the most recent version from the continuous integration server.
 Perhaps I need to have a recipe per environment and TST is always latest
and PRD is hard versioned but that seems like a lot of recipe duplication
for what is essentially a steady-state because I always want to be running a
continuous integration server and encouraging our team to push changes.

Essentially I'd like to be able to call:
puppetd --no-daemonize --test --setvar logmaster::prg_version=2.1
--tags=logmaster

This would then kick off an update for the logmaster recipe for version 2.1.

Is it possible to easily override a recipe variable at the command line or
is there a better approach others have taken if they've encountered this
scenario?

thanks,
chuck

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to