diff options
author | mh <mh@immerda.ch> | 2009-10-30 20:20:42 +0100 |
---|---|---|
committer | mh <mh@immerda.ch> | 2009-10-30 20:20:42 +0100 |
commit | b0e0f720d0f0480c96c377bde6f46a2d8820f646 (patch) | |
tree | 2438d4c1a636e8c81ee5f12320a5d5c8d3a8ce03 | |
parent | 87d2fe06d1b91c76cdc6ef59cf4d0c48db3da134 (diff) | |
download | puppet-apt-b0e0f720d0f0480c96c377bde6f46a2d8820f646.tar.gz puppet-apt-b0e0f720d0f0480c96c377bde6f46a2d8820f646.tar.bz2 |
add refactored files
-rw-r--r-- | manifests/default_preferences.pp | 16 | ||||
-rw-r--r-- | manifests/default_sources_list.pp | 10 | ||||
-rw-r--r-- | manifests/dselect.pp | 10 | ||||
-rw-r--r-- | manifests/preseeded_package.pp | 18 | ||||
-rw-r--r-- | manifests/upgrade_package.pp | 19 |
5 files changed, 73 insertions, 0 deletions
diff --git a/manifests/default_preferences.pp b/manifests/default_preferences.pp new file mode 100644 index 0000000..659474f --- /dev/null +++ b/manifests/default_preferences.pp @@ -0,0 +1,16 @@ +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 => File[apt_config]; + } +} diff --git a/manifests/default_sources_list.pp b/manifests/default_sources_list.pp new file mode 100644 index 0000000..8c14b53 --- /dev/null +++ b/manifests/default_sources_list.pp @@ -0,0 +1,10 @@ +class apt::default_sources_list { + config_file { + # include main, security and backports + # additional sources could be included via an array + "/etc/apt/sources.list": + content => template("apt/sources.list.erb"), + require => Exec[assert_lsbdistcodename]; + } +} + diff --git a/manifests/dselect.pp b/manifests/dselect.pp new file mode 100644 index 0000000..fb138da --- /dev/null +++ b/manifests/dselect.pp @@ -0,0 +1,10 @@ +class apt::dselect { + # suppress annoying help texts of dselect + line { dselect_expert: + file => "/etc/dpkg/dselect.cfg", + line => "expert", + ensure => present, + } + + package { dselect: ensure => installed } +} diff --git a/manifests/preseeded_package.pp b/manifests/preseeded_package.pp new file mode 100644 index 0000000..276c90f --- /dev/null +++ b/manifests/preseeded_package.pp @@ -0,0 +1,18 @@ +define apt::preseeded_package ($content = "", $ensure = "installed") { + $seedfile = "/var/cache/local/preseeding/$name.seeds" + $real_content = $content ? { + "" => template ( "$debian_version/$name.seeds" ), + Default => $content + } + + file{ $seedfile: + content => $real_content, + mode => 0600, owner => root, group => root, + } + + package { $name: + ensure => $ensure, + responsefile => $seedfile, + require => File[$seedfile], + } +} diff --git a/manifests/upgrade_package.pp b/manifests/upgrade_package.pp new file mode 100644 index 0000000..41d5d52 --- /dev/null +++ b/manifests/upgrade_package.pp @@ -0,0 +1,19 @@ +define apt::upgrade_package ($version = "") { + case $version { + '': { + exec { "aptitude -y install $name": + onlyif => [ "grep-status -F Status installed -a -P $name -q", "apt-show-versions -u $name | grep -q upgradeable" ], + } + } + 'latest': { + exec { "aptitude -y install $name": + onlyif => [ "grep-status -F Status installed -a -P $name -q", "apt-show-versions -u $name | grep -q upgradeable" ], + } + } + default: { + exec { "aptitude -y install $name=$version": + onlyif => [ "grep-status -F Status installed -a -P $name -q", "apt-show-versions -u $name | grep -q upgradeable" ], + } + } + } +} |