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