On Mon, May 24, 2010 at 8:17 AM, Gabriel - IP Guys <
gabr...@impactteachers.com> wrote:

> I'm still very new to puppet, and I've been away for the last few days,
> so please forgive me if my answer is old. But if you want to ensure that
> your repos are upto date, do what you would do on a normal box, and that
> is run apt-get update fairly often - once a day at 20 past midnight
> maybe. For that, maybe setup a cron job via puppet?
>
> Then, all you have to do, is wait 24 hours after a system has come under
> your control, and you should have an up to date system.
>
> I know it's a band aid idea, but it's a start :) Anyone want to expand
> on this?
>

Here's how we do it.

We have a class, "package::apt::update"

This contains the commands:

apt-get update
apt-get -f install
dpkg --configure -a
apt-get dist-upgrade

basically in that order with requires.

We initially started off with a global resource default defined:

Package { require => Class["package::apt::update"] }

The problem with this is that if you have an individual resource that also
needs its own require, you're overriding the global default, so you need to
remember to add it, like:

package { "foo":
  ...
  require => [ Class["package::apt::update"], File["something_else"], ],
}

So we've instead started moving towards a wrapped defined type:

define apt_package($ensure="latest") {
  package { $name:
    ensure  => $ensure,
    require => Class["package::apt::update"],
  }
}

which means you can simply do:

apt_package { "foo":
  require => File["something_else"],
}

and both requires are automatically applied.

We've also set up a similar define for repositories, "apt_repo", which is
guaranteed to run *before* Class["package::apt::update"], so everything
comes out in the right order.





>
>
> The Puppet Apprentice   :- http://puppetnewbie.blogspot.com/
> Follow me on twitter    :- http://twitter.com/mritguru
> Puppet #tag on twitter  :- #puppet
> IRC                     :- itguru ON irc.freenode.org (feel free to say
> hi!)
>
> --
> 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<puppet-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
>


-- 
nigel

-- 
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