retire smetana
[mirror/dsa-puppet.git] / modules / debian_org / manifests / apt.pp
1 # == Class: debian_org
2 #
3 # Stuff common to all debian.org servers
4 #
5 class debian_org::apt {
6         if versioncmp($::lsbmajdistrelease, '8') <= 0 {
7                 $fallbackmirror = 'http://cdn-fastly.deb.debian.org/debian/'
8         } else {
9                 $fallbackmirror = 'http://deb.debian.org/debian/'
10         }
11
12         if getfromhash($site::nodeinfo, 'hoster', 'mirror-debian') {
13                 $mirror = [ getfromhash($site::nodeinfo, 'hoster', 'mirror-debian'), $fallbackmirror ]
14         } else {
15                 $mirror = [ $fallbackmirror ]
16         }
17
18         site::aptrepo { 'debian':
19                 url        => $mirror,
20                 suite      => [ $::lsbdistcodename, "${::lsbdistcodename}-backports", "${::lsbdistcodename}-updates" ],
21                 components => ['main','contrib','non-free']
22         }
23
24         if versioncmp($::lsbmajdistrelease, '8') <= 0 {
25                 site::aptrepo { 'security':
26                         url        => [ 'http://security-cdn.debian.org/', 'http://security.debian.org/' ],
27                         suite      => "${::lsbdistcodename}/updates",
28                         components => ['main','contrib','non-free']
29                 }
30         } else {
31                 site::aptrepo { 'security':
32                         url        => [ 'http://security.debian.org/' ],
33                         suite      => "${::lsbdistcodename}/updates",
34                         components => ['main','contrib','non-free']
35                 }
36         }
37
38         $dbdosuites = [ 'debian-all', $::lsbdistcodename ]
39         site::aptrepo { 'db.debian.org':
40                 url        => 'http://db.debian.org/debian-admin',
41                 suite      => $dbdosuites,
42                 components => 'main',
43                 key        => 'puppet:///modules/debian_org/db.debian.org.gpg',
44         }
45
46         if ($::hostname in []) {
47                 site::aptrepo { 'proposed-updates':
48                         url        => $mirror,
49                         suite      => "${::lsbdistcodename}-proposed-updates",
50                         components => ['main','contrib','non-free']
51                 }
52         } else {
53                 site::aptrepo { 'proposed-updates':
54                         ensure => absent,
55                 }
56         }
57
58         site::aptrepo { 'debian-cdn':
59                 ensure => absent,
60         }
61         site::aptrepo { 'debian.org':
62                 ensure => absent,
63         }
64         site::aptrepo { 'debian2':
65                 ensure => absent,
66         }
67         site::aptrepo { 'backports2.debian.org':
68                 ensure => absent,
69         }
70         site::aptrepo { 'backports.debian.org':
71                 ensure => absent,
72         }
73         site::aptrepo { 'volatile':
74                 ensure => absent,
75         }
76         site::aptrepo { 'db.debian.org-suite':
77                 ensure => absent,
78         }
79         site::aptrepo { 'debian-lts':
80                 ensure => absent,
81         }
82
83
84
85
86         file { '/etc/apt/trusted-keys.d':
87                 ensure => absent,
88                 force  => true,
89         }
90
91         file { '/etc/apt/trusted.gpg':
92                 mode    => '0600',
93                 content => "",
94         }
95
96         file { '/etc/apt/preferences':
97                 source => 'puppet:///modules/debian_org/apt.preferences',
98         }
99         file { '/etc/apt/apt.conf.d/local-compression':
100                 source => 'puppet:///modules/debian_org/apt.conf.d/local-compression',
101         }
102         file { '/etc/apt/apt.conf.d/local-recommends':
103                 source => 'puppet:///modules/debian_org/apt.conf.d/local-recommends',
104         }
105         file { '/etc/apt/apt.conf.d/local-pdiffs':
106                 source => 'puppet:///modules/debian_org/apt.conf.d/local-pdiffs',
107         }
108         file { '/etc/apt/apt.conf.d/local-langs':
109                 source => 'puppet:///modules/debian_org/apt.conf.d/local-langs',
110         }
111
112         exec { 'apt-get update':
113                 path    => '/usr/bin:/usr/sbin:/bin:/sbin',
114                 onlyif  => '/usr/local/bin/check_for_updates',
115                 require => File['/usr/local/bin/check_for_updates']
116         }
117         Exec['apt-get update']->Package<| tag == extra_repo |>
118 }