2007-06-25 11:50:19 +02:00
|
|
|
# apt.pp - common components and defaults for handling apt
|
2008-09-29 22:27:18 +02:00
|
|
|
# Copyright (C) 2008 Micah Anerson <micah@riseup.net>
|
2007-06-25 11:50:19 +02:00
|
|
|
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
|
|
|
|
# See LICENSE for the full license granted to you.
|
|
|
|
|
|
|
|
class apt {
|
|
|
|
|
2010-10-09 14:39:11 +02:00
|
|
|
import "custom_sources.pp"
|
2010-10-24 13:32:14 +02:00
|
|
|
|
2009-10-30 18:21:42 +01:00
|
|
|
# See README
|
|
|
|
$real_apt_clean = $apt_clean ? {
|
|
|
|
'' => 'auto',
|
|
|
|
default => $apt_clean,
|
|
|
|
}
|
|
|
|
|
2009-10-30 22:19:07 +01:00
|
|
|
package { apt:
|
|
|
|
ensure => installed,
|
|
|
|
require => undef,
|
|
|
|
}
|
2009-10-30 18:21:42 +01:00
|
|
|
|
2010-10-24 13:32:14 +02:00
|
|
|
include lsb
|
2010-10-25 06:14:33 +02:00
|
|
|
config_file {
|
|
|
|
# include main, security and backports
|
|
|
|
# additional sources should be included via the custom_sources_template
|
|
|
|
# define
|
|
|
|
"/etc/apt/sources.list":
|
|
|
|
content => $custom_sources_list ? {
|
|
|
|
'' => template( "apt/$operatingsystem/sources.list.erb"),
|
|
|
|
default => $custom_sources_list
|
|
|
|
},
|
|
|
|
require => Package['lsb'];
|
2009-10-30 18:21:42 +01:00
|
|
|
}
|
|
|
|
|
2010-10-24 15:07:34 +02:00
|
|
|
# 01autoremove already present by default
|
|
|
|
apt_conf_snippet{ "02show_upgraded":
|
|
|
|
source => ["puppet:///modules/site-apt/${fqdn}/02show_upgraded",
|
|
|
|
"puppet:///modules/site-apt/02show_upgraded",
|
|
|
|
"puppet:///modules/apt/02show_upgraded"]
|
|
|
|
}
|
|
|
|
|
|
|
|
apt_conf_snippet{ "03clean":
|
|
|
|
source => ["puppet:///modules/site-apt/${fqdn}/03clean",
|
|
|
|
"puppet:///modules/site-apt/03clean",
|
|
|
|
"puppet:///modules/apt/03clean"]
|
2010-10-18 02:36:45 +02:00
|
|
|
}
|
|
|
|
|
2009-10-30 18:21:42 +01:00
|
|
|
case $custom_preferences {
|
2010-10-18 07:45:22 +02:00
|
|
|
false: {
|
2010-10-21 01:59:41 +02:00
|
|
|
include apt::preferences::absent
|
2009-10-30 18:21:42 +01:00
|
|
|
}
|
|
|
|
default: {
|
2010-10-21 01:59:41 +02:00
|
|
|
include apt::preferences
|
2009-10-30 18:21:42 +01:00
|
|
|
}
|
|
|
|
}
|
2007-06-25 11:50:19 +02:00
|
|
|
|
2009-10-30 20:35:30 +01:00
|
|
|
if $apt_unattended_upgrades {
|
|
|
|
include apt::unattended_upgrades
|
|
|
|
}
|
|
|
|
|
2010-05-09 22:44:40 +02:00
|
|
|
include common::moduledir
|
|
|
|
$apt_base_dir = "${common::moduledir::module_dir_path}/apt"
|
2009-10-30 21:43:43 +01:00
|
|
|
modules_dir { apt: }
|
2009-10-30 18:21:42 +01:00
|
|
|
# watch apt.conf.d
|
|
|
|
file { "/etc/apt/apt.conf.d": ensure => directory, checksum => mtime; }
|
|
|
|
|
|
|
|
exec {
|
|
|
|
# "&& sleep 1" is workaround for older(?) clients
|
2010-08-10 16:27:54 +02:00
|
|
|
'refresh_apt':
|
|
|
|
command => '/usr/bin/apt-get update && sleep 1',
|
2009-10-30 18:21:42 +01:00
|
|
|
refreshonly => true,
|
2010-10-17 15:18:08 +02:00
|
|
|
subscribe => File['/etc/apt/sources.list',
|
|
|
|
'/etc/apt/apt.conf.d',
|
|
|
|
'/etc/apt/preferences'];
|
2010-08-10 16:27:54 +02:00
|
|
|
'update_apt':
|
|
|
|
command => '/usr/bin/apt-get update && /usr/bin/apt-get autoclean',
|
2010-10-17 15:18:08 +02:00
|
|
|
require => File['/etc/apt/sources.list',
|
|
|
|
'/etc/apt/preferences'],
|
2010-06-28 21:49:09 +02:00
|
|
|
loglevel => info,
|
2009-10-30 18:21:42 +01:00
|
|
|
# Another Semaphor for all packages to reference
|
2010-09-03 01:14:23 +02:00
|
|
|
alias => "apt_updated";
|
2009-10-30 18:21:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
## This package should really always be current
|
|
|
|
package { "debian-archive-keyring": ensure => latest }
|
|
|
|
|
2010-09-09 00:39:33 +02:00
|
|
|
# backports uses the normal archive key now
|
|
|
|
package { "debian-backports-keyring": ensure => absent }
|
2009-10-30 18:21:42 +01:00
|
|
|
|
2010-09-15 22:31:42 +02:00
|
|
|
if $custom_key_dir {
|
|
|
|
file { "${apt_base_dir}/keys.d":
|
|
|
|
source => "$custom_key_dir",
|
|
|
|
recurse => true,
|
|
|
|
mode => 0755, owner => root, group => root,
|
2009-10-30 18:21:42 +01:00
|
|
|
}
|
2010-09-15 22:31:42 +02:00
|
|
|
exec { "find ${apt_base_dir}/keys.d -type f -exec apt-key add '{}' \\; && apt-get update":
|
|
|
|
alias => "custom_keys",
|
|
|
|
subscribe => File["${apt_base_dir}/keys.d"],
|
|
|
|
refreshonly => true,
|
2010-10-17 13:58:59 +02:00
|
|
|
before => Concatenated_file[apt_config];
|
2009-10-30 18:21:42 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# workaround for preseeded_package component
|
2010-09-15 22:31:42 +02:00
|
|
|
file { [ "/var/cache", "/var/cache/local", "/var/cache/local/preseeding" ]: ensure => directory }
|
2010-10-25 06:14:33 +02:00
|
|
|
}
|