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