Ask Your Question

PPAs not being installed before apt packages

asked 2014-02-26 13:26:15 -0500

mcandre gravatar image

updated 2014-02-26 13:27:25 -0500

I want to load some PPAs, then refresh apt, then install some packages. But I can't seem to find the right syntax for this.

For example, I want to load apt::ppa { 'ppa:cassou/emacs' }, then Exec['apt-update'], then package { 'emacs24': ensure => present }.

What should I type in order to achieve this?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2014-02-26 15:19:56 -0500

spuder gravatar image

updated 2014-02-26 15:21:42 -0500

Here is a code snippet that installs the latest version of git on ubuntu 12.04. No need to manually call apt-get update because the apt module should do it for you.

  # Include git ppa 
  apt::ppa { 'ppa:git-core/ppa':

  # Install key for repo (otherwise it prints error)
  apt::key { 'ppa:git-core/ppa':
      key   =>  'E1DF1F24',

  package { 'git-core':
    ensure  =>  latest,
    require =>  [

Since puppet doesn't guarantee that resources are executed in the order that they are listed in the file, you need to specify a 'require' or 'before'

edit flag offensive delete link more

answered 2014-02-26 17:30:31 -0500

Ancillas gravatar image

At the very top level of your Puppet code, you could try adding this to apply the ordering globally.

Apt::Ppa <| |> -> Package <| |>
Apt::Key<| |> -> Package<| |>

That makes all Apt::Ppa and Apt::Key resources run before all Package resources. You might run into some circular errors, but you can architect around them.

edit flag offensive delete link more

answered 2014-02-27 11:52:59 -0500

apennebaker gravatar image

Manual before/requires work for me:

exec { 'apt-update':
  command => 'apt-get update',
  path    => '/bin:/usr/bin',
  timeout => 0

apt::ppa { 'ppa:wnoronha/thrift':
  before => Exec['apt-update']

package { [
  ensure  => present,
  require => Exec['apt-update']
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-02-26 13:26:15 -0500

Seen: 3,108 times

Last updated: Feb 27 '14