Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to figure out the proper way to update/upgrade a deb package using puppet from a local source deb file. My current config looks like this...

class adobe-air-2-0-4 {

  file { "/opt/air-debs":
    ensure => directory
  }

  file { "/opt/air-debs/adobeair-2.0.4.deb":
    owner   => root,
    group   => root,
    mode    => 644,
    ensure  => present,
    source  => "puppet://puppet/adobe-air-2-0-4/adobeair-2.0.4.deb"
  }

  package { "adobeair":
    provider => dpkg,
    ensure => installed,
    source => "/opt/air-debs/adobeair-2.0.4.deb"
  }

}

I first copy the deb file down to the client machine and then use 'package' with the provider set to 'dpkg'. This works and I get the correct version installed.

My question is what is the proper way to update this package in the future. Can I simply change out the source file and puppet will know that it's a different version and update this package? How does puppet determine what version of a package it has installed versus the version of the source deb file?

I am pretty new to puppet, so if you have an suggestions for improvements to my existing config they are very much appreciated.

share|improve this question

1 Answer 1

up vote 25 down vote accepted

I also posted this question on the puppet users group and this was a response that I got back.

If you add ensure latest it will check the source file against the currently installed package and install the new one if it is latest. I'm still not sure how you would roll back to an older version, but this seems to solve my problem for now.

package { "puppet-dashboard":
 provider => dpkg,
 ensure   => latest,
 source   => "/tmp/puppet-dashboard_1.0.4rc2-1_all.deb"
}

Here is a link to the puppet user group post... http://groups.google.com/group/puppet-users/browse_thread/thread/53f5e7119012fb3e/59e8596701fcaf3f

share|improve this answer
    
Not tested, but if using apt as the provider. you can change latest to a string with the version number in - eg: ensure => '1.0.4rc2-1_all' –  benlumley Apr 28 '11 at 13:09
    
Having checked docs.puppetlabs.com/references/latest/type.html#package - looks like my commend above is invalid, it says dpkg is not versionable. –  benlumley Apr 28 '11 at 13:11
    
Well, @benlumley, apt-get is versionable and dpkg (on which apt-get is based) is not. So it's kind of difficult to mix the two when you want to version like that. That's why in these cases it could be a good idea to setup a mini-repository and have apt-get manage it (which is the default provider on debian systems) –  Aktau May 2 '13 at 13:10

Your Answer

 
discard

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.