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