how to add apt repository with puppet

3,073 views
Skip to first unread message

Fernando Padilla

unread,
Jul 14, 2009, 12:40:34 PM7/14/09
to puppet...@googlegroups.com
I keep googling, but I can't seem to find the answer.

What's the best way to add a apt-repository (ubuntu or rpm), using
puppet, and still have all of the package resource dependencies met..

1) add repository (file to /etc/apt/sources.list.d/NEWREPFILE)
2) run apt-get update (if any files change under /etc/apt/.....)
3) make sure this is run before any other package[] resources are
attempted to be resolved.

I know I can set this up.. and do an explicit dependency between the
package resource I know lives in the new repository, but I wonder how
would I do it so that the new repository is added (and apt-get update is
run) before any package resource..

Nigel Kersten

unread,
Jul 14, 2009, 6:14:30 PM7/14/09
to puppet...@googlegroups.com
Package {
require => [ File["sources_list"], Exec["apt_update"],
}

assuming you have a File["sources_list"] set up to manage your
sources, and an Exec["apt_update"] to run apt-get update for you.

This will run every time, but if you want the Exec to be a bit
smarter, you'll need to do some logic there.

I'm quite happy with running apt-get update on each puppet run as we
don't run every 30 minutes.

>
> >
>



--
Nigel Kersten
nig...@google.com
System Administrator
Google, Inc.

Mark Foster

unread,
Jul 24, 2009, 1:32:51 AM7/24/09
to Puppet Users
In case it saves you any time...
the file in /etc/apt/sources.list.d/ needs to end in .list or it will
be ignored.

-Signed, someone who learned the hard way.
Reply all
Reply to author
Forward
0 new messages