module-puppetlabs-apt/manifests/source.pp
Ryan Coleman 76dbf992e0 Merge pull request #26 from pdxcat/ticket_12823_aptkey_defined_type
(#12823) Add apt::key defined type and modify apt::source to use it

Reviewed and tested by Ryan Coleman (ryan@puppetlabs.com)
2012-03-01 14:40:44 -08:00

61 lines
1.4 KiB
Puppet

# source.pp
# add an apt source
define apt::source(
$location = '',
$release = $lsbdistcodename,
$repos = 'main',
$include_src = true,
$required_packages = false,
$key = false,
$key_server = 'keyserver.ubuntu.com',
$key_content = false,
$key_source = false,
$pin = false
) {
include apt::params
if ! $release {
fail("lsbdistcodename fact not available: release parameter required")
}
file { "${name}.list":
path => "${apt::params::root}/sources.list.d/${name}.list",
ensure => file,
owner => root,
group => root,
mode => 644,
content => template("apt/source.list.erb"),
}
if $pin != false {
apt::pin { "${release}": priority => "${pin}" } -> File["${name}.list"]
}
exec { "${name} apt update":
command => "${apt::params::provider} update",
subscribe => File["${name}.list"],
refreshonly => true,
}
if $required_packages != false {
exec { "Required packages: '${required_packages}' for ${name}":
command => "${apt::params::provider} -y install ${required_packages}",
subscribe => File["${name}.list"],
refreshonly => true,
}
}
if $key != false {
apt::key { "Add key: ${key} from Apt::Source ${title}":
key => $key,
ensure => present,
key_server => $key_server,
key_content => $key_content,
key_source => $key_source,
before => File["${name}.list"],
}
}
}