introduce preferences snippet
Now, we have the possibility to externally add snippes, so that we can preferences for packages that are for example only in backports or unstable.
This commit is contained in:
parent
521ccfec19
commit
4d28e6668f
7 changed files with 57 additions and 46 deletions
19
README
19
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
|
||||
=========
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
}
|
|
@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
3
manifests/module_dir.pp
Normal file
3
manifests/module_dir.pp
Normal file
|
@ -0,0 +1,3 @@
|
|||
class apt::module_dir {
|
||||
module_dir{'apt': }
|
||||
}
|
28
manifests/preferences.pp
Normal file
28
manifests/preferences.pp
Normal file
|
@ -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];
|
||||
}
|
||||
}
|
11
manifests/preferences_snippet.pp
Normal file
11
manifests/preferences_snippet.pp
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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'],
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue