How to update a package using puppet and a .deb file

3,770 views
Skip to first unread message

Tim C

unread,
Oct 7, 2010, 11:46:35 AM10/7/10
to Puppet Users
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.

I have also posted this question here...
http://serverfault.com/questions/188632/how-to-update-a-package-using-puppet-and-a-deb-file

Tim C

unread,
Oct 8, 2010, 4:53:26 PM10/8/10
to Puppet Users
Can anyone help me with this or point me in the right direction? Do I
have to use a package repository to ensure a correct version or can I
do it using the approach below?
> I have also posted this question here...http://serverfault.com/questions/188632/how-to-update-a-package-using...

Jacob Helwig

unread,
Oct 8, 2010, 7:20:39 PM10/8/10
to puppet...@googlegroups.com

Tim,

I've never really used the dpkg provider before, but a quick test seems
to indicate that just changing the source file isn't sufficient to get
the new version installed.

Installing first with:

package { "puppet-dashboard":


provider => dpkg,
ensure => installed,

source => "/tmp/puppet-dashboard_1.0.4rc2-1_all.deb"
}

Then changing the source to be:

package { "puppet-dashboard":


provider => dpkg,
ensure => installed,

source => "/tmp/puppet-dashboard_1.0.4rc2-2_all.deb"
}

The 1.0.4rc2-2 version is not installed.

Off hand, I'm not sure what the right way to do it would be, but I can
confirm that just changing the source with the dpkg provider is not
sufficient.

--
Jacob Helwig

signature.asc

Jacob Helwig

unread,
Oct 8, 2010, 7:26:04 PM10/8/10
to puppet...@googlegroups.com
On Fri, 08 Oct 2010 16:20:39 -0700, Jacob Helwig wrote:
> Date: Fri, 8 Oct 2010 16:20:39 -0700
> From: Jacob Helwig <ja...@puppetlabs.com>
> To: puppet...@googlegroups.com
> Subject: Re: [Puppet Users] Re: How to update a package using puppet and a
> .deb file
> User-Agent: Mutt/1.5.20 (2009-06-14)
> Message-ID: <20101008232...@vfa-6z.perlninja.com>

Well, Nan just suggested that we try "ensure => latest", and that _does_
get it to upgrade the package, when the source line is changed.

So... Something like the following for the package should get what you
want:

package { "puppet-dashboard":
provider => dpkg,

ensure => latest,
source => "/tmp/puppet-dashboard_1.0.4rc2-1_all.deb"
}

--
Jacob Helwig

signature.asc

Tim C

unread,
Oct 11, 2010, 10:58:28 AM10/11/10
to Puppet Users
Thanks Jacob.. I'll try this out. I was also thinking about hosting
our own apt repo and then we could use "apt" instead of "dpkg"

On Oct 8, 7:26 pm, Jacob Helwig <ja...@puppetlabs.com> wrote:
> On Fri, 08 Oct 2010 16:20:39 -0700, Jacob Helwig wrote:
> > Date: Fri, 8 Oct 2010 16:20:39 -0700
> > From: Jacob Helwig <ja...@puppetlabs.com>
> > To: puppet...@googlegroups.com
> > Subject: Re: [Puppet Users] Re: How to update a package using puppet and a
> >  .deb file
> > User-Agent: Mutt/1.5.20 (2009-06-14)
> > Message-ID: <20101008232039.GE15...@vfa-6z.perlninja.com>
>  signature.asc
> < 1KViewDownload

Patrick

unread,
Oct 11, 2010, 1:15:15 PM10/11/10
to puppet...@googlegroups.com
You really want to do that. It's much easier to maintain.

Here's a tutorial for a really simple repository if you want it:
http://nerdica.com/?p=43

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

Reply all
Reply to author
Forward
0 new messages