]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/debian-org/manifests/init.pp
Make sure we get rid of os-prober everywhere
[dsa-puppet.git] / modules / debian-org / manifests / init.pp
1 # == Class: debian-org
2 #
3 # Stuff common to all debian.org servers
4 #
5 class debian-org {
6         if getfromhash($site::nodeinfo, 'hoster', 'mirror-debian') {
7                 $mirror = getfromhash($site::nodeinfo, 'hoster', 'mirror-debian')
8         } else {
9                 $mirror = 'http://http.debian.net/debian/'
10         }
11         if $::lsbmajdistrelease < 7 {
12                 $mirror_backports = 'http://backports.debian.org/debian-backports/'
13         } else {
14                 $mirror_backports = $mirror
15         }
16
17         $debianadmin = [
18                 'debian-archive-debian-samhain-reports@master.debian.org',
19                 'debian-admin@ftbfs.de',
20                 'weasel@debian.org',
21                 'steve@lobefin.net',
22                 'paravoid@debian.org',
23                 'zumbi@kos.to'
24         ]
25
26         package { [
27                         'klogd',
28                         'sysklogd',
29                         'rsyslog',
30                         'os-prober',
31                 ]:
32                 ensure => purged,
33         }
34         package { [
35                         'debian.org',
36                         'dsa-munin-plugins',
37                 ]:
38                 ensure => installed,
39                 tag    => extra_repo,
40         }
41
42         package { [
43                         'apt-utils',
44                         'bash-completion',
45                         'dnsutils',
46                         'less',
47                         'lsb-release',
48                         'libfilesystem-ruby1.8',
49                         'mtr-tiny',
50                         'nload',
51                         'pciutils',
52                 ]:
53                 ensure => installed,
54         }
55
56         if $::lsbmajdistrelease >= 7 {
57                 package { 'libfilesystem-ruby1.9.1':
58                         ensure => installed,
59                 }
60         }
61
62         munin::check { [
63                         'cpu',
64                         'entropy',
65                         'forks',
66                         'interrupts',
67                         'iostat',
68                         'irqstats',
69                         'load',
70                         'memory',
71                         'ntp_offset',
72                         'ntp_states',
73                         'open_files',
74                         'open_inodes',
75                         'processes',
76                         'swap',
77                         'uptime',
78                         'vmstat',
79                 ]:
80         }
81
82         if getfromhash($site::nodeinfo, 'broken-rtc') {
83                 package { 'fake-hwclock':
84                         ensure => installed,
85                         tag    => extra_repo,
86                 }
87         }
88
89         package { 'molly-guard':
90                 ensure => installed,
91         }
92         file { '/etc/molly-guard/run.d/10-check-kvm':
93                 mode    => '0755',
94                 source  => 'puppet:///modules/debian-org/molly-guard/10-check-kvm',
95                 require => Package['molly-guard'],
96         }
97         file { '/etc/molly-guard/run.d/15-acquire-reboot-lock':
98                 mode    => '0755',
99                 source  => 'puppet:///modules/debian-org/molly-guard/15-acquire-reboot-lock',
100                 require => Package['molly-guard'],
101         }
102
103         file { '/etc/apt/trusted-keys.d':
104                 ensure => absent,
105                 force  => true,
106         }
107
108         file { '/etc/apt/trusted.gpg':
109                 mode    => '0600',
110                 content => "",
111         }
112
113         site::aptrepo { 'security':
114                 url        => 'http://security.debian.org/',
115                 suite      => "${::lsbdistcodename}/updates",
116                 components => ['main','contrib','non-free']
117         }
118         if $::lsbmajdistrelease < 7 {
119                 site::aptrepo { 'debian-lts':
120                         url        => $mirror,
121                         suite      => "${::lsbdistcodename}-lts",
122                         components => ['main','contrib','non-free']
123                 }
124         } else {
125                 site::aptrepo { 'debian-lts':
126                         ensure => absent,
127                 }
128         }
129
130         site::aptrepo { 'backports.debian.org':
131                 url        => $mirror_backports,
132                 suite      => "${::lsbdistcodename}-backports",
133                 components => ['main','contrib','non-free']
134         }
135
136         site::aptrepo { 'volatile':
137                 url        => $mirror,
138                 suite      => "${::lsbdistcodename}-updates",
139                 components => ['main','contrib','non-free']
140         }
141
142         if ($::hostname in [ball, corelli, eysler, lucatelli, mayer, mayr, rem, pettersson]) or
143            ($::hoster in [bytemark, man-da]) {
144                 site::aptrepo { 'proposed-updates':
145                         url        => $mirror,
146                         suite      => "${::lsbdistcodename}-proposed-updates",
147                         components => ['main','contrib','non-free']
148                 }
149         } else {
150                 site::aptrepo { 'proposed-updates':
151                         ensure => absent,
152                 }
153         }
154
155         site::aptrepo { 'debian.org':
156                 ensure => absent,
157         }
158
159         site::aptrepo { 'db.debian.org':
160                 url        => 'http://db.debian.org/debian-admin',
161                 suite      => 'lenny',
162                 components => 'main',
163                 key        => 'puppet:///modules/debian-org/db.debian.org.gpg',
164         }
165
166         augeas { 'inittab_replicate':
167                 context => '/files/etc/inittab',
168                 changes => [
169                         'set ud/runlevels 2345',
170                         'set ud/action respawn',
171                         'set ud/process "/usr/bin/ud-replicated -d"',
172                 ],
173                 notify  => Exec['init q'],
174         }
175
176         if getfromhash($site::nodeinfo, 'hoster', 'mirror-debian') {
177                 site::aptrepo { 'debian':
178                         url        => getfromhash($site::nodeinfo, 'hoster', 'mirror-debian'),
179                         suite      => $::lsbdistcodename,
180                         components => ['main','contrib','non-free']
181                 }
182         }
183
184         file { '/etc/facter':
185                 ensure  => directory,
186                 purge   => true,
187                 force   => true,
188                 recurse => true,
189                 source  => 'puppet:///files/empty/',
190         }
191         file { '/etc/facter/facts.d':
192                 ensure => directory,
193         }
194         file { '/etc/facter/facts.d/debian_facts.yaml':
195                 content => template('debian-org/debian_facts.yaml.erb')
196         }
197         file { '/etc/apt/preferences':
198                 source => 'puppet:///modules/debian-org/apt.preferences',
199         }
200         file { '/etc/apt/apt.conf.d/local-compression':
201                 source => 'puppet:///modules/debian-org/apt.conf.d/local-compression',
202         }
203         file { '/etc/apt/apt.conf.d/local-recommends':
204                 source => 'puppet:///modules/debian-org/apt.conf.d/local-recommends',
205         }
206         file { '/etc/apt/apt.conf.d/local-pdiffs':
207                 source => 'puppet:///modules/debian-org/apt.conf.d/local-pdiffs',
208         }
209         file { '/etc/timezone':
210                 source => 'puppet:///modules/debian-org/timezone',
211                 notify => Exec['dpkg-reconfigure tzdata -pcritical -fnoninteractive'],
212         }
213         if $::hostname == handel {
214                 include puppetmaster::db
215                 $dbpassword = $puppetmaster::db::password
216         }
217         file { '/etc/puppet/puppet.conf':
218                 content => template('debian-org/puppet.conf.erb'),
219         }
220         file { '/etc/default/puppet':
221                 source => 'puppet:///modules/debian-org/puppet.default',
222         }
223         file { '/etc/cron.d/dsa-puppet-stuff':
224                 source  => 'puppet:///modules/debian-org/dsa-puppet-stuff.cron',
225                 require => Package['debian.org'],
226         }
227         file { '/etc/ldap/ldap.conf':
228                 require => Package['debian.org'],
229                 source  => 'puppet:///modules/debian-org/ldap.conf',
230         }
231         file { '/etc/pam.d/common-session':
232                 require => Package['debian.org'],
233                 content => template('debian-org/pam.common-session.erb'),
234         }
235         file { '/etc/pam.d/common-session-noninteractive':
236                 require => Package['debian.org'],
237                 content => template('debian-org/pam.common-session-noninteractive.erb'),
238         }
239         file { '/etc/rc.local':
240                 mode   => '0755',
241                 source => 'puppet:///modules/debian-org/rc.local',
242                 notify => Exec['rc.local start'],
243         }
244         file { '/etc/dsa':
245                 ensure => directory,
246                 mode   => '0755',
247         }
248         file { '/etc/dsa/cron.ignore.dsa-puppet-stuff':
249                 source  => 'puppet:///modules/debian-org/dsa-puppet-stuff.cron.ignore',
250                 require => Package['debian.org']
251         }
252         file { '/etc/nsswitch.conf':
253                 mode   => '0755',
254                 source => 'puppet:///modules/debian-org/nsswitch.conf',
255         }
256
257         # set mmap_min_addr to 4096 to mitigate
258         # Linux NULL-pointer dereference exploits
259         site::sysctl { 'mmap_min_addr':
260                 ensure => absent
261         }
262         site::sysctl { 'perf_event_paranoid':
263                 key   => 'kernel.perf_event_paranoid',
264                 value => '2',
265         }
266         site::alternative { 'editor':
267                 linkto => '/usr/bin/vim.basic',
268         }
269         site::alternative { 'view':
270                 linkto => '/usr/bin/vim.basic',
271         }
272         mailalias { 'samhain-reports':
273                 ensure    => present,
274                 recipient => $debianadmin,
275                 require   => Package['debian.org']
276         }
277
278         file { '/usr/local/bin/check_for_updates':
279                 source => 'puppet:///modules/debian-org/check_for_updates',
280                 mode   => '0755',
281                 owner  => root,
282                 group  => root,
283         }
284
285         exec { 'apt-get update':
286                 path    => '/usr/bin:/usr/sbin:/bin:/sbin',
287                 onlyif  => '/usr/local/bin/check_for_updates',
288                 require => File['/usr/local/bin/check_for_updates']
289         }
290         Exec['apt-get update']->Package<| tag == extra_repo |>
291
292         exec { 'dpkg-reconfigure tzdata -pcritical -fnoninteractive':
293                 path        => '/usr/bin:/usr/sbin:/bin:/sbin',
294                 refreshonly => true
295         }
296         exec { 'puppetmaster restart':
297                 path        => '/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin',
298                 refreshonly => true
299         }
300         exec { 'rc.local start':
301                 path        => '/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin',
302                 refreshonly => true
303         }
304         exec { 'init q':
305                 refreshonly => true
306         }
307
308         tidy { '/var/lib/puppet/clientbucket/':
309                 age      => '2w',
310                 recurse  => 9,
311                 type     => ctime,
312                 matches  => [ 'paths', 'contents' ],
313                 schedule => weekly
314         }
315
316         file { '/root/.bashrc':
317                 source => 'puppet:///modules/debian-org/root-dotfiles/bashrc',
318         }
319         file { '/root/.profile':
320                 source => 'puppet:///modules/debian-org/root-dotfiles/profile',
321         }
322         file { '/root/.screenrc':
323                 source => 'puppet:///modules/debian-org/root-dotfiles/screenrc',
324         }
325         file { '/root/.vimrc':
326                 source => 'puppet:///modules/debian-org/root-dotfiles/vimrc',
327         }
328 }