]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/debian-org/manifests/init.pp
Clear proposed-updates repo from hosts that do not have it now according to puppet
[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                 force  => true,
105         }
106
107         file { '/etc/apt/trusted.gpg':
108                 mode    => '0600',
109                 content => "",
110         }
111
112         site::aptrepo { 'security':
113                 url        => 'http://security.debian.org/',
114                 suite      => "${::lsbdistcodename}/updates",
115                 components => ['main','contrib','non-free']
116         }
117         if $::lsbmajdistrelease < 7 {
118                 site::aptrepo { 'debian-lts':
119                         url        => $mirror,
120                         suite      => "${::lsbdistcodename}-lts",
121                         components => ['main','contrib','non-free']
122                 }
123         } else {
124                 site::aptrepo { 'debian-lts':
125                         ensure => absent,
126                 }
127         }
128
129         site::aptrepo { 'backports.debian.org':
130                 url        => $mirror_backports,
131                 suite      => "${::lsbdistcodename}-backports",
132                 components => ['main','contrib','non-free']
133         }
134
135         site::aptrepo { 'volatile':
136                 url        => $mirror,
137                 suite      => "${::lsbdistcodename}-updates",
138                 components => ['main','contrib','non-free']
139         }
140
141         if $::hostname in [ball, corelli, eysler, lucatelli, mayer, mayr, rem, pettersson] {
142                 site::aptrepo { 'proposed-updates':
143                         url        => $mirror,
144                         suite      => "${::lsbdistcodename}-proposed-updates",
145                         components => ['main','contrib','non-free']
146                 }
147         } else {
148                 site::aptrepo { 'proposed-updates':
149                         ensure => absent,
150                 }
151         }
152
153         site::aptrepo { 'debian.org':
154                 ensure => absent,
155         }
156
157         site::aptrepo { 'db.debian.org':
158                 url        => 'http://db.debian.org/debian-admin',
159                 suite      => 'lenny',
160                 components => 'main',
161                 key        => 'puppet:///modules/debian-org/db.debian.org.gpg',
162         }
163
164         augeas { 'inittab_replicate':
165                 context => '/files/etc/inittab',
166                 changes => [
167                         'set ud/runlevels 2345',
168                         'set ud/action respawn',
169                         'set ud/process "/usr/bin/ud-replicated -d"',
170                 ],
171                 notify  => Exec['init q'],
172         }
173
174         if getfromhash($site::nodeinfo, 'hoster', 'mirror-debian') {
175                 site::aptrepo { 'debian':
176                         url        => getfromhash($site::nodeinfo, 'hoster', 'mirror-debian'),
177                         suite      => $::lsbdistcodename,
178                         components => ['main','contrib','non-free']
179                 }
180         }
181
182         file { '/etc/facter':
183                 ensure  => directory,
184                 purge   => true,
185                 force   => true,
186                 recurse => true,
187                 source  => 'puppet:///files/empty/',
188         }
189         file { '/etc/facter/facts.d':
190                 ensure => directory,
191         }
192         file { '/etc/facter/facts.d/debian_facts.yaml':
193                 content => template('debian-org/debian_facts.yaml.erb')
194         }
195         file { '/etc/apt/preferences':
196                 source => 'puppet:///modules/debian-org/apt.preferences',
197         }
198         file { '/etc/apt/apt.conf.d/local-compression':
199                 source => 'puppet:///modules/debian-org/apt.conf.d/local-compression',
200         }
201         file { '/etc/apt/apt.conf.d/local-recommends':
202                 source => 'puppet:///modules/debian-org/apt.conf.d/local-recommends',
203         }
204         file { '/etc/apt/apt.conf.d/local-pdiffs':
205                 source => 'puppet:///modules/debian-org/apt.conf.d/local-pdiffs',
206         }
207         file { '/etc/timezone':
208                 source => 'puppet:///modules/debian-org/timezone',
209                 notify => Exec['dpkg-reconfigure tzdata -pcritical -fnoninteractive'],
210         }
211         if $::hostname == handel {
212                 include puppetmaster::db
213                 $dbpassword = $puppetmaster::db::password
214         }
215         file { '/etc/puppet/puppet.conf':
216                 content => template('debian-org/puppet.conf.erb'),
217         }
218         file { '/etc/default/puppet':
219                 source => 'puppet:///modules/debian-org/puppet.default',
220         }
221         file { '/etc/cron.d/dsa-puppet-stuff':
222                 source  => 'puppet:///modules/debian-org/dsa-puppet-stuff.cron',
223                 require => Package['debian.org'],
224         }
225         file { '/etc/ldap/ldap.conf':
226                 require => Package['debian.org'],
227                 source  => 'puppet:///modules/debian-org/ldap.conf',
228         }
229         file { '/etc/pam.d/common-session':
230                 require => Package['debian.org'],
231                 content => template('debian-org/pam.common-session.erb'),
232         }
233         file { '/etc/pam.d/common-session-noninteractive':
234                 require => Package['debian.org'],
235                 content => template('debian-org/pam.common-session-noninteractive.erb'),
236         }
237         file { '/etc/rc.local':
238                 mode   => '0755',
239                 source => 'puppet:///modules/debian-org/rc.local',
240                 notify => Exec['rc.local start'],
241         }
242         file { '/etc/dsa':
243                 ensure => directory,
244                 mode   => '0755',
245         }
246         file { '/etc/dsa/cron.ignore.dsa-puppet-stuff':
247                 source  => 'puppet:///modules/debian-org/dsa-puppet-stuff.cron.ignore',
248                 require => Package['debian.org']
249         }
250         file { '/etc/nsswitch.conf':
251                 mode   => '0755',
252                 source => 'puppet:///modules/debian-org/nsswitch.conf',
253         }
254
255         # set mmap_min_addr to 4096 to mitigate
256         # Linux NULL-pointer dereference exploits
257         site::sysctl { 'mmap_min_addr':
258                 ensure => absent
259         }
260         site::sysctl { 'perf_event_paranoid':
261                 key   => 'kernel.perf_event_paranoid',
262                 value => '2',
263         }
264         site::alternative { 'editor':
265                 linkto => '/usr/bin/vim.basic',
266         }
267         site::alternative { 'view':
268                 linkto => '/usr/bin/vim.basic',
269         }
270         mailalias { 'samhain-reports':
271                 ensure    => present,
272                 recipient => $debianadmin,
273                 require   => Package['debian.org']
274         }
275
276         file { '/usr/local/bin/check_for_updates':
277                 source => 'puppet:///modules/debian-org/check_for_updates',
278                 mode   => '0755',
279                 owner  => root,
280                 group  => root,
281         }
282
283         exec { 'apt-get update':
284                 path    => '/usr/bin:/usr/sbin:/bin:/sbin',
285                 onlyif  => '/usr/local/bin/check_for_updates',
286                 require => File['/usr/local/bin/check_for_updates']
287         }
288         Exec['apt-get update']->Package<| tag == extra_repo |>
289
290         exec { 'dpkg-reconfigure tzdata -pcritical -fnoninteractive':
291                 path        => '/usr/bin:/usr/sbin:/bin:/sbin',
292                 refreshonly => true
293         }
294         exec { 'puppetmaster restart':
295                 path        => '/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin',
296                 refreshonly => true
297         }
298         exec { 'rc.local start':
299                 path        => '/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin',
300                 refreshonly => true
301         }
302         exec { 'init q':
303                 refreshonly => true
304         }
305
306         tidy { '/var/lib/puppet/clientbucket/':
307                 age      => '2w',
308                 recurse  => 9,
309                 type     => ctime,
310                 matches  => [ 'paths', 'contents' ],
311                 schedule => weekly
312         }
313
314         file { '/root/.bashrc':
315                 source => 'puppet:///modules/debian-org/root-dotfiles/bashrc',
316         }
317         file { '/root/.profile':
318                 source => 'puppet:///modules/debian-org/root-dotfiles/profile',
319         }
320         file { '/root/.screenrc':
321                 source => 'puppet:///modules/debian-org/root-dotfiles/screenrc',
322         }
323         file { '/root/.vimrc':
324                 source => 'puppet:///modules/debian-org/root-dotfiles/vimrc',
325         }
326 }