Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Still trying to get puppet to "do what I want" (I still don't know how to talk to it properly)...

I have the following problem: an Apache server hosts the static content for several clients, and this static content is versioned:

node {
    client { 'c1':
        version => 'v1',
        # otherstuff
    client { 'c2':
        version => 'v2',

There are 30+ clients defined this way. And in total, there are between 2 and 4 versions of the content installed at any time.

Now, with time, the versions evolve -- quite rapidly. Right now I can only achieve to install new content, but never remove obsolete content.

How would you go about having reference counting for installed versions, and uninstall obsolete versions?

share|improve this question
What sort of resources are c1 and c2? Are they rpm/deb packages, tar files, directories you're rsyncing, etc? This will affect the solutions available. – kashani Jan 20 '12 at 19:05
c1 and c2 are just "names". v1 and v2 are, at the moment, RPM versions. But I am not constrained to RPM in any way: I control what format the resource is, it can be anything else, as long as I can make puppet manage it – fge Jan 20 '12 at 19:40

Store your static content in a git repository. Create a branch for each version of content that you want. Use puppet to create a repository if there isn't one, to ensure the correct branch is checked out, and to automatically update the repository. Git will take care of adding and removing files from there. Repoint your branches to whatever revision is appropriate at any given time.

Alternately, you might find that rsync with the proper flags (delete files not present on the master) might also work.

share|improve this answer

Simplest solution could be though there is management overhead in adding and removing packages.

  package { 'c1_v8': ensure => present, }
  package { 'c2_v7': ensure => present, }

  package { 'c1_v1': ensure => absent, }
  package { 'c2_v2': ensure => absent, }

You could get fancier by using an external data source like hiera w/ puppet-hiera to manage which packages should be on which servers.

share|improve this answer
Well, here, the external sources are two, at a minimum: the RPM database (whether managed by yum or rpm) holds version information, and the "puppet database" knows which versions I want at a given moment. Trouble is, none of them is stateful. And here I need to know the state at step n-1 before the decision is made. – fge Jan 20 '12 at 21:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.