92aa5a51e9
Add a file resource on the apt/sources.list.d directory to ensure that it is created as a directory and watch it for modifications to automatically refresh the apt cache. Signed-off-by: Gabriel Filion <lelutin@gmail.com>
29 lines
676 B
Puppet
29 lines
676 B
Puppet
define apt::sources_list (
|
|
$ensure = 'present',
|
|
$source = '',
|
|
$content = undef
|
|
) {
|
|
if $source == '' and $content == undef {
|
|
fail("One of \$source or \$content must be specified for apt_sources_snippet ${name}")
|
|
}
|
|
if $source != '' and $content != undef {
|
|
fail("Only one of \$source or \$content must specified for apt_sources_snippet ${name}")
|
|
}
|
|
|
|
file { "/etc/apt/sources.list.d/${name}":
|
|
ensure => $ensure,
|
|
owner => root, group => 0, mode => 0600;
|
|
}
|
|
|
|
if $source {
|
|
File["/etc/apt/sources.list.d/${name}"] {
|
|
source => $source,
|
|
}
|
|
}
|
|
else {
|
|
File["/etc/apt/sources.list.d/${name}"] {
|
|
content => $content,
|
|
}
|
|
}
|
|
}
|
|
|