summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README19
-rw-r--r--manifests/default_preferences.pp16
-rw-r--r--manifests/init.pp24
-rw-r--r--manifests/module_dir.pp3
-rw-r--r--manifests/preferences.pp28
-rw-r--r--manifests/preferences_snippet.pp11
-rw-r--r--manifests/unattended_upgrades.pp2
7 files changed, 57 insertions, 46 deletions
diff --git a/README b/README
index e624bba..b52a024 100644
--- a/README
+++ b/README
@@ -50,17 +50,6 @@ following variable before including this class will pull in the
templates/apt/sources.list file:
$custom_sources_list ='template("apt/sources.list")'
-$custom_preferences
---------------------
-By default this module will use a basic apt/preferences file with
-unstable and testing pinned to very low values so that any package
-installation will not accidentally pull in packages from those suites
-unless you explicitly specify the version number. You can set this
-variable to pull in a customized apt/preferences template, for
-example, setting the following variable before including this class
-will pull in the templates/apt/preferences file:
-$custom_preferences = 'template("apt/preferences")'
-
$custom_key_dir
---------------
If you have different apt-key files that you want to get added to your
@@ -81,6 +70,14 @@ Classes
This module contains only the apt class, which sets up all described
functionality.
+Defines
+=======
+
+apt::preferences_snippet
+------------------------
+
+A way to add pinning information to /etc/apt/preferences
+
Resources
=========
diff --git a/manifests/default_preferences.pp b/manifests/default_preferences.pp
deleted file mode 100644
index 3cdb355..0000000
--- a/manifests/default_preferences.pp
+++ /dev/null
@@ -1,16 +0,0 @@
-class apt::default_preferences {
- config_file {
- # this just pins unstable and testing to very low values
- "/etc/apt/preferences":
- content => template("apt/preferences.erb"),
- # use File[apt_config] to reference a completed configuration
- # See "The Puppet Semaphor" 2007-06-25 on the puppet-users ML
- alias => apt_config,
- # only update together
- require => File["/etc/apt/sources.list"];
- # little default settings which keep the system sane
- "/etc/apt/apt.conf.d/from_puppet":
- content => "APT::Get::Show-Upgraded true;\nDSelect::Clean $real_apt_clean;\n",
- before => Config_file[apt_config];
- }
-}
diff --git a/manifests/init.pp b/manifests/init.pp
index 78ae6c5..12096a0 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -29,18 +29,7 @@ class apt {
}
}
- case $custom_preferences {
- '': {
- include apt::default_preferences
- }
- default: {
- config_file { "/etc/apt/preferences":
- content => $custom_preferences,
- alias => apt_config,
- require => File["/etc/apt/sources.list"];
- }
- }
- }
+ include apt::preferences
if $apt_unattended_upgrades {
include apt::unattended_upgrades
@@ -58,13 +47,12 @@ class apt {
command => '/usr/bin/apt-get update && sleep 1',
refreshonly => true,
subscribe => [ File["/etc/apt/sources.list"],
- File["/etc/apt/preferences"],
File["/etc/apt/apt.conf.d"],
- Config_file[apt_config] ];
+ Concatenated_file[apt_config] ];
'update_apt':
command => '/usr/bin/apt-get update && /usr/bin/apt-get autoclean',
require => [ File["/etc/apt/sources.list"],
- File["/etc/apt/preferences"], Config_file[apt_config] ],
+ File["/etc/apt/preferences"], Concatenated_file[apt_config] ],
loglevel => info,
# Another Semaphor for all packages to reference
alias => apt_updated;
@@ -88,7 +76,7 @@ class apt {
alias => "backports_key",
refreshonly => true,
subscribe => File["${apt_base_dir}/backports.org.key"],
- before => [ File[apt_config], Package["debian-backports-keyring"] ]
+ before => [ Concatenated_file[apt_config], Package["debian-backports-keyring"] ]
}
}
lenny: {
@@ -105,7 +93,7 @@ class apt {
alias => "backports_key",
refreshonly => true,
subscribe => File["${apt_base_dir}/backports.org.key"],
- before => [ Config_file[apt_config], Package["debian-backports-keyring"] ]
+ before => [ Concatenated_file[apt_config], Package["debian-backports-keyring"] ]
}
}
}
@@ -120,7 +108,7 @@ class apt {
alias => "custom_keys",
subscribe => File["${apt_base_dir}/keys.d"],
refreshonly => true,
- before => Config_file[apt_config];
+ before => Concatenated_file[apt_config];
}
}
diff --git a/manifests/module_dir.pp b/manifests/module_dir.pp
new file mode 100644
index 0000000..6dcfca3
--- /dev/null
+++ b/manifests/module_dir.pp
@@ -0,0 +1,3 @@
+class apt::module_dir {
+ module_dir{'apt': }
+}
diff --git a/manifests/preferences.pp b/manifests/preferences.pp
new file mode 100644
index 0000000..b106153
--- /dev/null
+++ b/manifests/preferences.pp
@@ -0,0 +1,28 @@
+class apt::preferences {
+
+ include apt::module_dir
+ module_dir{'apt/preferences': }
+ concatenated_file{'/etc/apt/preferences':
+ dir => '/var/lib/puppet/modules/apt/preferences',
+ header => 'Package: *
+Pin: release a=unstable
+Pin-Priority: 1
+
+Package: *
+Pin: release a=testing
+Pin-Priority: 2
+',
+ # use Concatenated_file[apt_config] to reference a completed configuration
+ # See "The Puppet Semaphor" 2007-06-25 on the puppet-users ML
+ alias => apt_config,
+ # only update together
+ require => File["/etc/apt/sources.list"];
+ }
+
+ config_file {
+ # little default settings which keep the system sane
+ "/etc/apt/apt.conf.d/from_puppet":
+ content => "APT::Get::Show-Upgraded true;\nDSelect::Clean $real_apt_clean;\n",
+ before => Concatenated_file[apt_config];
+ }
+}
diff --git a/manifests/preferences_snippet.pp b/manifests/preferences_snippet.pp
new file mode 100644
index 0000000..52edf97
--- /dev/null
+++ b/manifests/preferences_snippet.pp
@@ -0,0 +1,11 @@
+define apt::preferences_snippet(
+ $ensure => 'present',
+ $content
+){
+ file { "/var/lib/puppet/modules/apt/preferences/${name}":
+ ensure => $ensure,
+ content => "${content}\n",
+ notify => Exec['concat_/var/lib/puppet/modules/apt/preferences'],
+ owner => root, group => 0, mode => 0600;
+ }
+}
diff --git a/manifests/unattended_upgrades.pp b/manifests/unattended_upgrades.pp
index c984c40..9a6c13b 100644
--- a/manifests/unattended_upgrades.pp
+++ b/manifests/unattended_upgrades.pp
@@ -9,7 +9,7 @@ class apt::unattended_upgrades {
content => 'APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
',
- before => Config_file[apt_config],
+ before => Concatenated_file[apt_config],
require => Package['unattended-upgrades'],
}
}