]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/debian-org/manifests/init.pp
collect slightly fewer packages
[dsa-puppet.git] / modules / debian-org / manifests / init.pp
1 class debian-org {
2
3         $debianadmin = [
4                 'debian-archive-debian-samhain-reports@master.debian.org',
5                 'debian-admin@ftbfs.de',
6                 'weasel@debian.org',
7                 'steve@lobefin.net',
8                 'paravoid@debian.org'
9         ]
10
11         package { [
12                         'klogd',
13                         'sysklogd',
14                         'rsyslog',
15                 ]:
16                 ensure => purged,
17         }
18         package { [
19                         'debian.org',
20                         'dsa-munin-plugins',
21                 ]:
22                 ensure => installed,
23                 tag    => extra_repo,
24         }
25
26         package { [
27                         'apt-utils',
28                         'bash-completion',
29                         'dnsutils',
30                         'less',
31                         'lsb-release',
32                         'libfilesystem-ruby1.8',
33                         'mtr-tiny',
34                         'nload',
35                         'pciutils',
36                 ]:
37                 ensure => installed,
38         }
39
40         if $::lsbmajdistrelease >= 7 {
41                 package { 'libfilesystem-ruby1.9':
42                         ensure => installed,
43                 }
44         }
45
46         munin::check { [
47                         'cpu',
48                         'entropy',
49                         'forks',
50                         'interrupts',
51                         'iostat',
52                         'irqstats',
53                         'load',
54                         'memory',
55                         'ntp_offset',
56                         'ntp_states',
57                         'open_files',
58                         'open_inodes',
59                         'processes',
60                         'swap',
61                         'uptime',
62                         'vmstat',
63                 ]:
64         }
65
66         if getfromhash($site::nodeinfo, 'broken-rtc') {
67                 package { 'fake-hwclock':
68                         ensure => installed,
69                         tag    => extra_repo,
70                 }
71         }
72
73         package { 'molly-guard':
74                 ensure => installed,
75         }
76         file { '/etc/molly-guard/run.d/10-check-kvm':
77                 mode    => '0755',
78                 source  => 'puppet:///modules/debian-org/molly-guard/10-check-kvm',
79                 require => Package['molly-guard'],
80         }
81         file { '/etc/molly-guard/run.d/15-acquire-reboot-lock':
82                 mode    => '0755',
83                 source  => 'puppet:///modules/debian-org/molly-guard/15-acquire-reboot-lock',
84                 require => Package['molly-guard'],
85         }
86
87         site::aptrepo { 'security':
88                 url        => 'http://security.debian.org/',
89                 suite      => "${::lsbdistcodename}/updates",
90                 components => ['main','contrib','non-free']
91         }
92
93         if $::lsbdistcodename != 'wheezy' {
94                 site::aptrepo { 'backports.debian.org':
95                         url        => 'http://backports.debian.org/debian-backports/',
96                         suite      => "${::lsbdistcodename}-backports",
97                         components => ['main','contrib','non-free']
98                 }
99
100                 if getfromhash($site::nodeinfo, 'hoster', 'mirror-debian') {
101                         site::aptrepo { 'volatile':
102                                 url        => getfromhash($site::nodeinfo, 'hoster', 'mirror-debian'),
103                                 suite      => "${::lsbdistcodename}-updates",
104                                 components => ['main','contrib','non-free']
105                         }
106                 } else {
107                         site::aptrepo { 'volatile':
108                                 url        => 'http://ftp.debian.org/debian',
109                                 suite      => "${::lsbdistcodename}-updates",
110                                 components => ['main','contrib','non-free']
111                         }
112                 }
113         }
114         site::aptrepo { 'backports.org':
115                 ensure => absent,
116                 keyid => '16BA136C',
117                 key => 'puppet:///modules/debian-org/backports.org.asc',
118         }
119
120         site::aptrepo { 'debian.org':
121                 ensure => absent,
122         }
123
124         site::aptrepo { 'db.debian.org':
125                 url        => 'http://db.debian.org/debian-admin',
126                 suite      => 'lenny',
127                 components => 'main',
128                 key        => 'puppet:///modules/debian-org/db.debian.org.asc',
129         }
130
131         if getfromhash($site::nodeinfo, 'hoster', 'mirror-debian') {
132                 site::aptrepo { 'debian':
133                         url        => getfromhash($site::nodeinfo, 'hoster', 'mirror-debian'),
134                         suite      => $::lsbdistcodename,
135                         components => ['main','contrib','non-free']
136                 }
137         }
138
139         file { '/etc/facter':
140                 ensure  => directory,
141                 purge   => true,
142                 force   => true,
143                 recurse => true,
144                 source  => 'puppet:///files/empty/',
145         }
146         file { '/etc/facter/facts.d':
147                 ensure => directory,
148         }
149         file { '/etc/facter/facts.d/debian_facts.yaml':
150                 content => template('debian-org/debian_facts.yaml.erb')
151         }
152         file { '/etc/apt/preferences':
153                 source => 'puppet:///modules/debian-org/apt.preferences',
154         }
155         file { '/etc/apt/trusted-keys.d/':
156                 ensure => directory,
157                 purge  => true,
158         }
159         file { '/etc/apt/apt.conf.d/local-compression':
160                 source => 'puppet:///modules/debian-org/apt.conf.d/local-compression',
161         }
162         file { '/etc/apt/apt.conf.d/local-recommends':
163                 source => 'puppet:///modules/debian-org/apt.conf.d/local-recommends',
164         }
165         file { '/etc/apt/apt.conf.d/local-pdiffs':
166                 source => 'puppet:///modules/debian-org/apt.conf.d/local-pdiffs',
167         }
168         file { '/etc/timezone':
169                 source => 'puppet:///modules/debian-org/timezone',
170                 notify => Exec['dpkg-reconfigure tzdata -pcritical -fnoninteractive'],
171         }
172         if $::hostname == handel {
173                 include puppetmaster::db
174                 $dbpassword = $puppetmaster::db::password
175         }
176         file { '/etc/puppet/puppet.conf':
177                 content => template('debian-org/puppet.conf.erb'),
178         }
179         file { '/etc/default/puppet':
180                 source => 'puppet:///modules/debian-org/puppet.default',
181         }
182         file { '/etc/cron.d/dsa-puppet-stuff':
183                 source => 'puppet:///modules/debian-org/dsa-puppet-stuff.cron',
184                 require => Package['debian.org'],
185         }
186         file { '/etc/ldap/ldap.conf':
187                 require => Package['debian.org'],
188                 source => 'puppet:///modules/debian-org/ldap.conf',
189         }
190         file { '/etc/pam.d/common-session':
191                 require => Package['debian.org'],
192                 content => template('debian-org/pam.common-session.erb'),
193         }
194         file { '/etc/pam.d/common-session-noninteractive':
195                 require => Package['debian.org'],
196                 content => template('debian-org/pam.common-session-noninteractive.erb'),
197         }
198         file { '/etc/rc.local':
199                 mode   => '0755',
200                 source => 'puppet:///modules/debian-org/rc.local',
201                 notify => Exec['rc.local start'],
202         }
203         file { '/etc/dsa':
204                 ensure => directory,
205                 mode   => '0755',
206         }
207         file { '/etc/dsa/cron.ignore.dsa-puppet-stuff':
208                 source  => 'puppet:///modules/debian-org/dsa-puppet-stuff.cron.ignore',
209                 require => Package['debian.org']
210         }
211
212         # set mmap_min_addr to 4096 to mitigate
213         # Linux NULL-pointer dereference exploits
214         site::sysctl { 'mmap_min_addr':
215                 key   => 'vm.mmap_min_addr',
216                 value => '4096',
217         }
218         site::alternative { 'editor':
219                 linkto => '/usr/bin/vim.basic',
220         }
221         site::alternative { 'view':
222                 linkto => '/usr/bin/vim.basic',
223         }
224         mailalias { 'samhain-reports':
225                 ensure => present,
226                 recipient => $debianadmin,
227                 require => Package['debian.org']
228         }
229
230         exec { 'apt-get update':
231                 path        => '/usr/bin:/usr/sbin:/bin:/sbin',
232                 refreshonly => true,
233         }
234         Exec['apt-get update']->Package<| tag == extra_repo |>
235
236         exec { 'dpkg-reconfigure tzdata -pcritical -fnoninteractive':
237                 path        => '/usr/bin:/usr/sbin:/bin:/sbin',
238                 refreshonly => true
239         }
240         exec { 'puppetmaster restart':
241                 path        => '/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin',
242                 refreshonly => true
243         }
244         exec { 'rc.local start':
245                 path        => '/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin',
246                 refreshonly => true
247         }
248         exec { 'init q':
249                 refreshonly => true
250         }
251 }