diff options
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/apt_conf.pp | 8 | ||||
-rw-r--r-- | manifests/apticron.pp | 54 | ||||
-rw-r--r-- | manifests/cron/base.pp | 3 | ||||
-rw-r--r-- | manifests/dselect.pp | 1 | ||||
-rw-r--r-- | manifests/init.pp | 47 | ||||
-rw-r--r-- | manifests/listchanges.pp | 38 | ||||
-rw-r--r-- | manifests/preferences.pp | 4 | ||||
-rw-r--r-- | manifests/preferences/absent.pp | 3 | ||||
-rw-r--r-- | manifests/preferences_snippet.pp | 5 | ||||
-rw-r--r-- | manifests/preseeded_package.pp | 4 | ||||
-rw-r--r-- | manifests/sources_list.pp | 5 | ||||
-rw-r--r-- | manifests/unattended_upgrades.pp | 3 | ||||
-rw-r--r-- | manifests/upgrade_package.pp | 1 |
13 files changed, 141 insertions, 35 deletions
diff --git a/manifests/apt_conf.pp b/manifests/apt_conf.pp index 62e4377..c484ec3 100644 --- a/manifests/apt_conf.pp +++ b/manifests/apt_conf.pp @@ -1,11 +1,13 @@ define apt::apt_conf( $ensure = 'present', $source = '', - $content = undef -){ + $content = undef ) +{ + if $source == '' and $content == undef { fail("One of \$source or \$content must be specified for apt_conf ${name}") } + if $source != '' and $content != undef { fail("Only one of \$source or \$content must specified for apt_conf ${name}") } @@ -13,7 +15,7 @@ define apt::apt_conf( file { "/etc/apt/apt.conf.d/${name}": ensure => $ensure, notify => Exec["refresh_apt"], - owner => root, group => 0, mode => 0600; + owner => root, group => 0, mode => 0644; } if $source { diff --git a/manifests/apticron.pp b/manifests/apticron.pp new file mode 100644 index 0000000..2fe8e44 --- /dev/null +++ b/manifests/apticron.pp @@ -0,0 +1,54 @@ +class apt::apticron { + + case $apticron_ensure_version { + '': { $apticron_ensure_version = "present" } + } + + case $apticron_config { + '': { $apticron_config = "apt/${operatingsystem}/apticron_${lsbdistcodename}.erb" } + } + + case $apticron_email { + '': { $apticron_email = "root" } + } + + case $apticron_diff_only { + '': { $apticron_diff_only = "1" } + } + + case $apticron_listchanges_profile { + '': { $apticron_listchanges_profile = "apticron" } + } + + case $apticron_system { + '': { $apticron_system = false } + } + + case $apticron_ipaddressnum { + '': { $apticron_ipaddressnum = false } + } + + case $apticron_ipaddresses { + '': { $apticron_ipaddresses = false } + } + + case $apticron_notifyholds { + '': { $apticron_notifyholds = "0" } + } + + case $apticron_notifynew { + '': { $apticron_notifynew = "0" } + } + + case $apticron_customsubject { + '': { $apticron_customsubject = "" } + } + + package { apticron: ensure => $apticron_ensure_version } + + file { "/etc/apticron/apticron.conf": + content => template($apticron_config), + mode => 0644, owner => root, group => root, + require => Package["apticron"]; + } +} diff --git a/manifests/cron/base.pp b/manifests/cron/base.pp index 2cfbefb..de55772 100644 --- a/manifests/cron/base.pp +++ b/manifests/cron/base.pp @@ -1,3 +1,4 @@ class apt::cron::base { - package { cron-apt: ensure => installed } + + package { cron-apt: ensure => installed } } diff --git a/manifests/dselect.pp b/manifests/dselect.pp index 52c66cb..45a5ddc 100644 --- a/manifests/dselect.pp +++ b/manifests/dselect.pp @@ -1,4 +1,5 @@ class apt::dselect { + # suppress annoying help texts of dselect append_if_no_such_line { dselect_expert: file => "/etc/dpkg/dselect.cfg", diff --git a/manifests/init.pp b/manifests/init.pp index 3f2a523..2d46ad4 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -21,7 +21,7 @@ class apt { } $debian_url = $apt_debian_url ? { - '' => 'http://ftp.debian.org/debian/', + '' => 'http://cdn.debian.net/debian/', default => "${apt_debian_url}", } $security_url = $apt_security_url ? { @@ -88,17 +88,27 @@ class apt { } apt_conf { "02show_upgraded": - source => ["puppet:///modules/site-apt/${fqdn}/02show_upgraded", - "puppet:///modules/site-apt/02show_upgraded", - "puppet:///modules/apt/02show_upgraded"] + source => [ "puppet:///modules/site-apt/${fqdn}/02show_upgraded", + "puppet:///modules/site-apt/02show_upgraded", + "puppet:///modules/apt/02show_upgraded" ] } - apt_conf { "03clean": - source => ["puppet:///modules/site-apt/${fqdn}/03clean", - "puppet:///modules/site-apt/03clean", - "puppet:///modules/apt/03clean"] + if ( $virtual == "vserver" ) { + apt_conf { "03clean_vserver": + source => [ "puppet:///modules/site-apt/${fqdn}/03clean_vserver", + "puppet:///modules/site-apt/03clean_vserver", + "puppet:///modules/apt/03clean_vserver" ], + alias => "03clean"; + } } - + else { + apt_conf { "03clean": + source => [ "puppet:///modules/site-apt/${fqdn}/03clean", + "puppet:///modules/site-apt/03clean", + "puppet:///modules/apt/03clean" ] + } + } + case $custom_preferences { false: { include apt::preferences::absent @@ -112,13 +122,9 @@ 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" - ]: + [ "/etc/apt/apt.conf.d/from_puppet", "/etc/apt/apt.conf.d/99from_puppet" ]: ensure => 'absent', - require => [ Apt_conf['02show_upgraded'], - Apt_conf['03clean'], - ], + require => [ Apt_conf['02show_upgraded'], Apt_conf['03clean'] ]; } # watch .d directories and ensure they are present @@ -134,13 +140,12 @@ class apt { 'refresh_apt': command => '/usr/bin/apt-get update && sleep 1', refreshonly => true, - subscribe => [ File['/etc/apt/apt.conf.d'], - Config_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'], + require => [ File['/etc/apt/apt.conf.d', '/etc/apt/preferences' ], Config_file['/etc/apt/sources.list'] ], loglevel => info, # Another Semaphor for all packages to reference @@ -163,8 +168,8 @@ class apt { recurse => true, mode => 0755, owner => root, group => root, } - exec { "find ${apt_base_dir}/keys.d -type f -exec apt-key add '{}' \\; && apt-get update": - alias => "custom_keys", + exec { "custom_keys": + command => "find ${apt_base_dir}/keys.d -type f -exec apt-key add '{}' \\; && apt-get update", subscribe => File["${apt_base_dir}/keys.d"], refreshonly => true, } diff --git a/manifests/listchanges.pp b/manifests/listchanges.pp new file mode 100644 index 0000000..964a75d --- /dev/null +++ b/manifests/listchanges.pp @@ -0,0 +1,38 @@ +class apt::listchanges { + + case $listchanges_version { + '': { $listchanges_version = "present" } + } + + case $listchanges_config { + '': { $listchanges_config = "apt/${operatingsystem}/listchanges_${lsbdistcodename}.erb" } + } + + case $listchanges_frontend { + '': { $listchanges_frontend = "pager" } + } + + case $listchanges_email { + '': { $listchanges_email = "root" } + } + + case $listchanges_confirm { + '': { $listchanges_confirm = "0" } + } + + case $listchanges_saveseen { + '': { $listchanges_saveseen = "/var/lib/apt/listchanges.db" } + } + + case $listchanges_which { + '': { $listchanges_which = "both" } + } + + package { apt-listchanges: ensure => $listchanges_ensure_version } + + file { "/etc/apt/listchanges.conf": + content => template($listchanges_config), + mode => 0644, owner => root, group => root, + require => Package["apt-listchanges"]; + } +} diff --git a/manifests/preferences.pp b/manifests/preferences.pp index 4acfdaf..4c93542 100644 --- a/manifests/preferences.pp +++ b/manifests/preferences.pp @@ -3,7 +3,7 @@ class apt::preferences { include common::moduledir $apt_preferences_dir = "${common::moduledir::module_dir_path}/apt/preferences" module_dir{'apt/preferences': } - file{"${apt_preferences_dir}_header": + file { "${apt_preferences_dir}_header": content => $custom_preferences ? { '' => $operatingsystem ? { 'debian' => template("apt/${operatingsystem}/preferences_${codename}.erb"), @@ -13,7 +13,7 @@ class apt::preferences { }, } - concatenated_file{'/etc/apt/preferences': + concatenated_file { '/etc/apt/preferences': dir => $apt_preferences_dir, header => "${apt_preferences_dir}_header", # use Concatenated_file[apt_config] to reference a completed configuration diff --git a/manifests/preferences/absent.pp b/manifests/preferences/absent.pp index d8b2e10..0e96119 100644 --- a/manifests/preferences/absent.pp +++ b/manifests/preferences/absent.pp @@ -1,5 +1,6 @@ class apt::preferences::absent { - file {'/etc/apt/preferences': + + file { '/etc/apt/preferences': ensure => absent, } } diff --git a/manifests/preferences_snippet.pp b/manifests/preferences_snippet.pp index fd2956d..4b8e575 100644 --- a/manifests/preferences_snippet.pp +++ b/manifests/preferences_snippet.pp @@ -2,8 +2,9 @@ define apt::preferences_snippet( $ensure = 'present', $source = '', $release, - $priority -){ + $priority ) +{ + if $custom_preferences == false { fail("Trying to define a preferences_snippet with \$custom_preferences set to false.") } diff --git a/manifests/preseeded_package.pp b/manifests/preseeded_package.pp index 76c432e..839f200 100644 --- a/manifests/preseeded_package.pp +++ b/manifests/preseeded_package.pp @@ -1,11 +1,11 @@ define apt::preseeded_package ($content = "", $ensure = "installed") { $seedfile = "/var/cache/local/preseeding/$name.seeds" $real_content = $content ? { - "" => template ( "$name.seeds", "$debian_version/$name.seeds" ), + "" => template ( "site-apt/$lsbdistcodename/$name.seeds" ), default => $content } - file{ $seedfile: + file { $seedfile: content => $real_content, mode => 0600, owner => root, group => root, } diff --git a/manifests/sources_list.pp b/manifests/sources_list.pp index bbf887a..ff8f21a 100644 --- a/manifests/sources_list.pp +++ b/manifests/sources_list.pp @@ -1,8 +1,9 @@ define apt::sources_list ( $ensure = 'present', $source = '', - $content = undef -) { + $content = undef ) +{ + if $source == '' and $content == undef { fail("One of \$source or \$content must be specified for apt_sources_snippet ${name}") } diff --git a/manifests/unattended_upgrades.pp b/manifests/unattended_upgrades.pp index f52448d..e2992f8 100644 --- a/manifests/unattended_upgrades.pp +++ b/manifests/unattended_upgrades.pp @@ -1,5 +1,6 @@ class apt::unattended_upgrades { - package{'unattended-upgrades': + + package { 'unattended-upgrades': ensure => present, require => undef, } diff --git a/manifests/upgrade_package.pp b/manifests/upgrade_package.pp index 41d5d52..99e9c2a 100644 --- a/manifests/upgrade_package.pp +++ b/manifests/upgrade_package.pp @@ -1,4 +1,5 @@ define apt::upgrade_package ($version = "") { + case $version { '': { exec { "aptitude -y install $name": |