module-puppetlabs-apt/manifests/source.pp

62 lines
1.4 KiB
ObjectPascal
Raw Normal View History

2010-04-27 22:38:28 +02:00
# 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
2010-04-27 22:38:28 +02:00
) {
include apt::params
2010-04-27 22:38:28 +02:00
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"],
}
}
2010-04-27 22:38:28 +02:00
}