]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/debian-org/manifests/init.pp
Merge branch 'master' of git+ssh://puppet.debian.org/srv/puppet.debian.org/git/dsa...
[dsa-puppet.git] / modules / debian-org / manifests / init.pp
1 class debian-org {
2         if getfromhash($site::nodeinfo, 'hoster', 'mirror-debian') {
3                 $mirror = getfromhash($site::nodeinfo, 'hoster', 'mirror-debian')
4         } else {
5                 $mirror = 'http://http.debian.net/debian/'
6         }
7         if $::lsbmajdistrelease < 7 {
8                 $mirror_backports = 'http://backports.debian.org/debian-backports/'
9         } else {
10                 $mirror_backports = $mirror
11         }
12
13         $debianadmin = [
14                 'debian-archive-debian-samhain-reports@master.debian.org',
15                 'debian-admin@ftbfs.de',
16                 'weasel@debian.org',
17                 'steve@lobefin.net',
18                 'paravoid@debian.org'
19         ]
20
21         package { [
22                         'klogd',
23                         'sysklogd',
24                         'rsyslog',
25                 ]:
26                 ensure => purged,
27         }
28         package { [
29                         'debian.org',
30                         'dsa-munin-plugins',
31                 ]:
32                 ensure => installed,
33                 tag    => extra_repo,
34         }
35
36         package { [
37                         'apt-utils',
38                         'bash-completion',
39                         'dnsutils',
40                         'less',
41                         'lsb-release',
42                         'libfilesystem-ruby1.8',
43                         'mtr-tiny',
44                         'nload',
45                         'pciutils',
46                 ]:
47                 ensure => installed,
48         }
49
50         if $::lsbmajdistrelease >= 7 {
51                 package { 'libfilesystem-ruby1.9.1':
52                         ensure => installed,
53                 }
54         }
55
56         munin::check { [
57                         'cpu',
58                         'entropy',
59                         'forks',
60                         'interrupts',
61                         'iostat',
62                         'irqstats',
63                         'load',
64                         'memory',
65                         'ntp_offset',
66                         'ntp_states',
67                         'open_files',
68                         'open_inodes',
69                         'processes',
70                         'swap',
71                         'uptime',
72                         'vmstat',
73                 ]:
74         }
75
76         if getfromhash($site::nodeinfo, 'broken-rtc') {
77                 package { 'fake-hwclock':
78                         ensure => installed,
79                         tag    => extra_repo,
80                 }
81         }
82
83         package { 'molly-guard':
84                 ensure => installed,
85         }
86         file { '/etc/molly-guard/run.d/10-check-kvm':
87                 mode    => '0755',
88                 source  => 'puppet:///modules/debian-org/molly-guard/10-check-kvm',
89                 require => Package['molly-guard'],
90         }
91         file { '/etc/molly-guard/run.d/15-acquire-reboot-lock':
92                 mode    => '0755',
93                 source  => 'puppet:///modules/debian-org/molly-guard/15-acquire-reboot-lock',
94                 require => Package['molly-guard'],
95         }
96
97         site::aptrepo { 'security':
98                 url        => 'http://security.debian.org/',
99                 suite      => "${::lsbdistcodename}/updates",
100                 components => ['main','contrib','non-free']
101         }
102
103         site::aptrepo { 'backports.debian.org':
104                 url        => $mirror_backports,
105                 suite      => "${::lsbdistcodename}-backports",
106                 components => ['main','contrib','non-free']
107         }
108         site::aptrepo { 'backports.org':
109                 ensure => absent,
110                 keyid => '16BA136C',
111                 key => 'puppet:///modules/debian-org/backports.org.asc',
112         }
113
114         site::aptrepo { 'volatile':
115                 url        => $mirror,
116                 suite      => "${::lsbdistcodename}-updates",
117                 components => ['main','contrib','non-free']
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         file { '/etc/nsswitch.conf':
212                 mode   => '0755',
213                 source => 'puppet:///modules/debian-org/nsswitch.conf',
214         }
215
216         # set mmap_min_addr to 4096 to mitigate
217         # Linux NULL-pointer dereference exploits
218         site::sysctl { 'mmap_min_addr':
219                 key   => 'vm.mmap_min_addr',
220                 value => '4096',
221         }
222         site::alternative { 'editor':
223                 linkto => '/usr/bin/vim.basic',
224         }
225         site::alternative { 'view':
226                 linkto => '/usr/bin/vim.basic',
227         }
228         mailalias { 'samhain-reports':
229                 ensure => present,
230                 recipient => $debianadmin,
231                 require => Package['debian.org']
232         }
233
234         exec { 'apt-get update':
235                 path        => '/usr/bin:/usr/sbin:/bin:/sbin',
236                 refreshonly => true,
237         }
238         Exec['apt-get update']->Package<| tag == extra_repo |>
239
240         exec { 'dpkg-reconfigure tzdata -pcritical -fnoninteractive':
241                 path        => '/usr/bin:/usr/sbin:/bin:/sbin',
242                 refreshonly => true
243         }
244         exec { 'puppetmaster restart':
245                 path        => '/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin',
246                 refreshonly => true
247         }
248         exec { 'rc.local start':
249                 path        => '/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin',
250                 refreshonly => true
251         }
252         exec { 'init q':
253                 refreshonly => true
254         }
255 }