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