module-puppetlabs-apt/manifests/init.pp

85 lines
2 KiB
ObjectPascal
Raw Normal View History

#
class apt(
2012-05-22 00:48:00 +02:00
$always_apt_update = false,
$apt_update_frequency = 'reluctantly',
2012-05-22 00:48:00 +02:00
$purge_sources_list = false,
2012-05-22 00:51:33 +02:00
$purge_sources_list_d = false,
$purge_preferences = false,
$purge_preferences_d = false,
$update_timeout = undef,
2014-03-05 22:59:21 +01:00
$update_tries = undef,
$sources = undef,
2015-02-15 18:09:47 +01:00
) inherits ::apt::params {
2010-04-27 22:38:28 +02:00
2015-02-15 18:09:47 +01:00
include apt::update
$frequency_options = ['always','daily','weekly','reluctantly']
validate_re($apt_update_frequency, $frequency_options)
validate_bool($purge_sources_list, $purge_sources_list_d,
$purge_preferences, $purge_preferences_d)
$sources_list_content = $purge_sources_list ? {
false => undef,
true => "# Repos managed by puppet.\n",
}
if $always_apt_update == true {
Exec <| title=='apt_update' |> {
refreshonly => false,
}
}
apt::setting { 'conf-update-stamp':
priority => 15,
content => template('apt/_header.erb', 'apt/15update-stamp.erb'),
}
file { 'sources.list':
ensure => present,
path => $::apt::sources_list,
owner => root,
group => root,
mode => '0644',
content => $sources_list_content,
notify => Exec['apt_update'],
}
2011-03-11 18:02:50 +01:00
file { 'sources.list.d':
ensure => directory,
path => $::apt::sources_list_d,
owner => root,
group => root,
purge => $purge_sources_list_d,
recurse => $purge_sources_list_d,
notify => Exec['apt_update'],
}
2014-05-05 12:06:39 +02:00
if $purge_preferences {
file { 'apt-preferences':
2014-09-05 18:51:39 +02:00
ensure => absent,
path => $::apt::preferences,
}
}
2012-05-22 00:51:33 +02:00
file { 'preferences.d':
ensure => directory,
path => $::apt::preferences_d,
2012-05-22 00:51:33 +02:00
owner => root,
group => root,
purge => $purge_preferences_d,
recurse => $purge_preferences_d,
}
# Need anchor to provide containment for dependencies.
2012-08-21 22:55:24 +02:00
anchor { 'apt::update':
require => Class['apt::update'],
}
# manage sources if present
if $sources != undef {
validate_hash($sources)
create_resources('apt::source', $sources)
}
2010-04-27 22:38:28 +02:00
}