summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
Diffstat (limited to 'manifests')
-rw-r--r--manifests/cron/base.pp3
-rw-r--r--manifests/cron/dist-upgrade.pp23
-rw-r--r--manifests/cron/download.pp21
-rw-r--r--manifests/dselect.pp3
-rw-r--r--manifests/init.pp102
-rw-r--r--manifests/preferences.pp10
-rw-r--r--manifests/preseeded_package.pp4
7 files changed, 142 insertions, 24 deletions
diff --git a/manifests/cron/base.pp b/manifests/cron/base.pp
new file mode 100644
index 0000000..2cfbefb
--- /dev/null
+++ b/manifests/cron/base.pp
@@ -0,0 +1,3 @@
+class apt::cron::base {
+ package { cron-apt: ensure => installed }
+}
diff --git a/manifests/cron/dist-upgrade.pp b/manifests/cron/dist-upgrade.pp
new file mode 100644
index 0000000..3d7cf16
--- /dev/null
+++ b/manifests/cron/dist-upgrade.pp
@@ -0,0 +1,23 @@
+class apt::cron::dist-upgrade inherits apt::cron::base {
+
+ $action = "autoclean -y
+dist-upgrade -y -o APT::Get::Show-Upgraded=true
+"
+
+ file { "/etc/cron-apt/action.d/3-download":
+ ensure => absent,
+ }
+
+ package { "apt-listbugs": ensure => absent }
+
+ config_file { "/etc/cron-apt/action.d/4-dist-upgrade":
+ content => $action,
+ require => Package[cron-apt]
+ }
+
+ config_file { "/etc/cron-apt/config.d/MAILON":
+ content => "MAILON=upgrade\n",
+ require => Package[cron-apt]
+ }
+
+}
diff --git a/manifests/cron/download.pp b/manifests/cron/download.pp
new file mode 100644
index 0000000..a27967d
--- /dev/null
+++ b/manifests/cron/download.pp
@@ -0,0 +1,21 @@
+class apt::cron::download inherits apt::cron::base {
+
+ $action = "autoclean -y
+dist-upgrade -d -y -o APT::Get::Show-Upgraded=true
+"
+
+ file { "/etc/cron-apt/action.d/4-dist-upgrade":
+ ensure => absent,
+ }
+
+ config_file { "/etc/cron-apt/action.d/3-download":
+ content => $action,
+ require => Package[cron-apt]
+ }
+
+ config_file { "/etc/cron-apt/config.d/MAILON":
+ content => "MAILON=changes\n",
+ require => Package[cron-apt]
+ }
+
+}
diff --git a/manifests/dselect.pp b/manifests/dselect.pp
index fb138da..52c66cb 100644
--- a/manifests/dselect.pp
+++ b/manifests/dselect.pp
@@ -1,9 +1,8 @@
class apt::dselect {
# suppress annoying help texts of dselect
- line { dselect_expert:
+ append_if_no_such_line { dselect_expert:
file => "/etc/dpkg/dselect.cfg",
line => "expert",
- ensure => present,
}
package { dselect: ensure => installed }
diff --git a/manifests/init.pp b/manifests/init.pp
index 140d2a6..c48cb6e 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -5,20 +5,77 @@
class apt {
+ $use_volatile = $apt_volatile_enabled ? {
+ '' => false,
+ default => $apt_volatile_enabled,
+ }
+
+ $include_src = $apt_include_src ? {
+ '' => false,
+ default => $apt_include_src,
+ }
+
+ $use_next_release = $apt_use_next_release ? {
+ '' => false,
+ default => $apt_use_next_release,
+ }
+
+ $debian_url = $apt_debian_url ? {
+ '' => 'http://ftp.debian.org/debian/',
+ default => "${apt_debian_url}",
+ }
+ $security_url = $apt_security_url ? {
+ '' => 'http://security.debian.org/',
+ default => "${apt_security_url}",
+ }
+ $backports_url = $apt_backports_url ? {
+ '' => 'http://backports.debian.org/debian-backports/',
+ default => "${apt_backports_url}",
+ }
+ $volatile_url = $apt_volatile_url ? {
+ '' => 'http://volatile.debian.org/debian-volatile/',
+ default => "${apt_volatile_url}",
+ }
+ $ubuntu_url = $apt_ubuntu_url ? {
+ '' => 'http://archive.ubuntu.com/ubuntu',
+ default => "${apt_ubuntu_url}",
+ }
+ case $operatingsystem {
+ 'debian': {
+ $repos = $apt_repos ? {
+ '' => 'main contrib non-free',
+ default => "${apt_repos}",
+ }
+ }
+ 'ubuntu': {
+ $repos = $apt_repos ? {
+ '' => 'main restricted universe multiverse',
+ default => "${apt_repos}",
+ }
+ }
+ }
+
package { apt:
ensure => installed,
require => undef,
}
- $real_main_apt_source = $main_apt_source ? {
- '' => $operatingsystem ? {
- "Ubuntu" => "http://de.archive.ubuntu.com/ubuntu/",
- default => "http://ftp.debian.org/debian/",
- },
- default => $main_apt_source,
+ include lsb
+
+ # init $release, $next_release, $codename, $next_codename
+ case $lsbdistcodename {
+ '': {
+ $codename = $lsbdistcodename
+ $release = $lsbdistrelease
+ }
+ default: {
+ $codename = $lsbdistcodename
+ $release = debian_release($codename)
+ }
}
+ $next_codename = debian_nextcodename($codename)
+ $next_release = debian_nextrelease($release)
- include lsb
config_file {
# include main, security and backports
# additional sources should be included via the apt::sources_list define
@@ -30,7 +87,6 @@ class apt {
require => Package['lsb'];
}
- # 01autoremove already present by default
apt_conf { "02show_upgraded":
source => ["puppet:///modules/site-apt/${fqdn}/02show_upgraded",
"puppet:///modules/site-apt/02show_upgraded",
@@ -54,6 +110,17 @@ class apt {
}
}
+ # backward compatibility: upgrade from previous versions of this module.
+ file {
+ ["/etc/apt/apt.conf.d/from_puppet",
+ "/etc/apt/apt.conf.d/99from_puppet"
+ ]:
+ ensure => 'absent',
+ require => [ Apt_conf_snippet['02show_upgraded'],
+ Apt_conf_snippet['03clean'],
+ ],
+ }
+
# watch .d directories and ensure they are present
file { "/etc/apt/apt.conf.d": ensure => directory, checksum => mtime; }
file { "/etc/apt/sources.list.d":
@@ -67,16 +134,17 @@ class apt {
'refresh_apt':
command => '/usr/bin/apt-get update && sleep 1',
refreshonly => true,
- subscribe => File['/etc/apt/sources.list',
- '/etc/apt/apt.conf.d',
- '/etc/apt/preferences'];
- 'update_apt':
- command => '/usr/bin/apt-get update && /usr/bin/apt-get autoclean',
- require => File['/etc/apt/sources.list',
+ subscribe => [ File['/etc/apt/apt.conf.d'],
+ Config_file['/etc/apt/sources.list'] ];
+ 'update_apt':
+ command => '/usr/bin/apt-get update && /usr/bin/apt-get autoclean',
+ refreshonly => true,
+ require => [ File['/etc/apt/apt.conf.d',
'/etc/apt/preferences'],
- loglevel => info,
- # Another Semaphor for all packages to reference
- alias => "apt_updated";
+ Config_file['/etc/apt/sources.list'] ],
+ loglevel => info,
+ # Another Semaphor for all packages to reference
+ alias => "apt_updated";
}
## This package should really always be current
diff --git a/manifests/preferences.pp b/manifests/preferences.pp
index 5be3bd0..4acfdaf 100644
--- a/manifests/preferences.pp
+++ b/manifests/preferences.pp
@@ -4,9 +4,13 @@ class apt::preferences {
$apt_preferences_dir = "${common::moduledir::module_dir_path}/apt/preferences"
module_dir{'apt/preferences': }
file{"${apt_preferences_dir}_header":
- source => ["puppet:///modules/site-apt/${fqdn}/preferences",
- "puppet:///modules/site-apt/preferences",
- "puppet:///modules/apt/preferences"]
+ content => $custom_preferences ? {
+ '' => $operatingsystem ? {
+ 'debian' => template("apt/${operatingsystem}/preferences_${codename}.erb"),
+ 'ubuntu' => '',
+ },
+ default => $custom_preferences
+ },
}
concatenated_file{'/etc/apt/preferences':
diff --git a/manifests/preseeded_package.pp b/manifests/preseeded_package.pp
index 276c90f..76c432e 100644
--- a/manifests/preseeded_package.pp
+++ b/manifests/preseeded_package.pp
@@ -1,8 +1,8 @@
define apt::preseeded_package ($content = "", $ensure = "installed") {
$seedfile = "/var/cache/local/preseeding/$name.seeds"
$real_content = $content ? {
- "" => template ( "$debian_version/$name.seeds" ),
- Default => $content
+ "" => template ( "$name.seeds", "$debian_version/$name.seeds" ),
+ default => $content
}
file{ $seedfile: