More kfreebsd removal
[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, 'http://debian.anycast-test.mirrors.debian.org/debian/' ]
14         } else {
15                 $mirror = [ $fallbackmirror, 'http://debian.anycast-test.mirrors.debian.org/debian/' ]
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 ($::hostname in [smetana]) {
25                 site::aptrepo { 'security':
26                         ensure => absent,
27                 }
28         } else {
29                 site::aptrepo { 'security':
30                         url        => [ 'http://security-cdn.debian.org/', 'http://security.anycast-test.mirrors.debian.org/debian-security/', 'http://security.debian.org/' ],
31                         suite      => "${::lsbdistcodename}/updates",
32                         components => ['main','contrib','non-free']
33                 }
34         }
35
36         $dbdosuites = [ 'debian-all', $::lsbdistcodename ]
37         site::aptrepo { 'db.debian.org':
38                 url        => 'http://db.debian.org/debian-admin',
39                 suite      => $dbdosuites,
40                 components => 'main',
41                 key        => 'puppet:///modules/debian_org/db.debian.org.gpg',
42         }
43
44         if ($::hostname in []) {
45                 site::aptrepo { 'proposed-updates':
46                         url        => $mirror,
47                         suite      => "${::lsbdistcodename}-proposed-updates",
48                         components => ['main','contrib','non-free']
49                 }
50         } else {
51                 site::aptrepo { 'proposed-updates':
52                         ensure => absent,
53                 }
54         }
55
56         site::aptrepo { 'debian-cdn':
57                 ensure => absent,
58         }
59         site::aptrepo { 'debian.org':
60                 ensure => absent,
61         }
62         site::aptrepo { 'debian2':
63                 ensure => absent,
64         }
65         site::aptrepo { 'backports2.debian.org':
66                 ensure => absent,
67         }
68         site::aptrepo { 'backports.debian.org':
69                 ensure => absent,
70         }
71         site::aptrepo { 'volatile':
72                 ensure => absent,
73         }
74         site::aptrepo { 'db.debian.org-suite':
75                 ensure => absent,
76         }
77         site::aptrepo { 'debian-lts':
78                 ensure => absent,
79         }
80
81
82
83
84         file { '/etc/apt/trusted-keys.d':
85                 ensure => absent,
86                 force  => true,
87         }
88
89         file { '/etc/apt/trusted.gpg':
90                 mode    => '0600',
91                 content => "",
92         }
93
94         file { '/etc/apt/preferences':
95                 source => 'puppet:///modules/debian_org/apt.preferences',
96         }
97         file { '/etc/apt/apt.conf.d/local-compression':
98                 source => 'puppet:///modules/debian_org/apt.conf.d/local-compression',
99         }
100         file { '/etc/apt/apt.conf.d/local-recommends':
101                 source => 'puppet:///modules/debian_org/apt.conf.d/local-recommends',
102         }
103         file { '/etc/apt/apt.conf.d/local-pdiffs':
104                 source => 'puppet:///modules/debian_org/apt.conf.d/local-pdiffs',
105         }
106         file { '/etc/apt/apt.conf.d/local-langs':
107                 source => 'puppet:///modules/debian_org/apt.conf.d/local-langs',
108         }
109
110         exec { 'apt-get update':
111                 path    => '/usr/bin:/usr/sbin:/bin:/sbin',
112                 onlyif  => '/usr/local/bin/check_for_updates',
113                 require => File['/usr/local/bin/check_for_updates']
114         }
115         Exec['apt-get update']->Package<| tag == extra_repo |>
116 }