Added apt::ppa which installs Ubuntu PPA archives.

This commit is contained in:
Timo Mkinen 2012-03-23 08:33:18 +02:00
parent 9c58553bf5
commit c31e4360f4

View file

@ -16,6 +16,62 @@ class apt {
} }
# Install common packages for using PPA's.
#
class apt::ppa::helper {
package { "python-software-properties":
ensure => installed,
}
}
# Add PPA archive to system.
#
# === Parameters
#
# $name:
# PPA name. Needs to be in format "ppa:user/ppa-name".
#
# $ensure:
# Ensure archive is absent or present. Defaults to present.
#
# === Sample usage
#
# apt::ppa { "ppa:igraph/ppa": }
#
define apt::ppa($ensure = "present") {
tag("bootstrap")
include apt::ppa::helper
$fname = gsub($name, "^ppa:([^\/]+)\/(.+)", "\\1-\\2-${lsbdistcodename}.list")
case $ensure {
"present": {
exec { "add-apt-repository ${name}":
path => "/bin:/usr/bin:/sbin:/usr/sbin",
user => "root",
creates => $fname,
require => Package["python-software-properties"],
notify => Exec["apt-get-update"],
}
}
"absent": {
file { $fname:
ensure => absent,
notify => Exec["apt-get-update"],
}
}
default: {
fail("test")
}
}
}
# Configure /etc/apt/sources.list # Configure /etc/apt/sources.list
# #
# === Global variables # === Global variables