Re: [Puppet Users] Puppet + APT, I am lost...

Héctor Rivas Gándara
Tue, 07 Sep 2010 11:24:57 -0000

> For the past week, I have been trying to figure out the best way to do
> package management with Puppet on an Ubuntu system. I have studied many
> solutons I found on the web, but none of them seem to do exactly what I
want.


I am not sure if somebody proposed this already, but may be you can
use this approach:

In the puppetmaster:

 * you have a puppet-file repository called files/debian-reps-sums or
something like that.
 * You have an script scheduled each 5, 15 or 30m, that will write
files for each repository with the sums. Something like this:

   wget http://ftp.fr.debian.org/debian/dists/lenny/Release -q -O - |grep
main/binary-i386 > ftp.fr.debian.org_lenny_main_binary-i386.sums

In the configuration:
 * Each host that depens on that repository, will has a reference on
that file, storing it somewhere. You add a "notify =>
Exec["update-repository"]. Exec["update-repository"], of
cuorse,
should be notify-only.

     # Force apt-get update if needed
    file {
"${debianmirror}_${distribution}_${component}_binary-${architecture}.sums":
        source =>
"puppet:///debian-reps-sums/${debianmirror}_${distribution}_${component}_binary-${architecture}.sums",
        path   =>
"/var/lib/puppet/debian-reps-sums/${debianmirror}_${distribution}_${component}_binary-${architecture}.sums",
        owner  => "root",
        group  => 0,
        mode   => "0664",
        notify => Exec["apt-get_update"]
    }

You can create a definition to configure repositories and add this dependency.

I found this method in a to control "stow" installations from
http://trac.cae.tntech.edu/infrastructure/

With this method:
 * apt-get update will run on client only when needed.
 * Only one node (puppetmaster) will check if there are new updates.
 * You can easily force apt-get update if needed

--
Atentamente
Héctor Rivas