/[adm]/puppet/modules/buildsystem/manifests/init.pp
ViewVC logotype

Contents of /puppet/modules/buildsystem/manifests/init.pp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1524 - (show annotations) (download)
Mon Apr 18 09:41:37 2011 UTC (13 years ago) by boklm
File size: 11728 byte(s)
add software GPG key
1 class buildsystem {
2
3 class base {
4 $build_login = "iurt"
5 $build_home_dir = "/home/$build_login"
6 $sched_login = "schedbot"
7 $sched_home_dir = "/var/lib/$sched_login"
8 $packages_archivedir = "$sched_home_dir/old"
9 $sign_login = "signbot"
10 $sign_home_dir = "/var/lib/$sign_login"
11 $sign_keydir = "$sign_home_dir/keys"
12 # FIXME: maybe keyid should be defined at an other place
13 $sign_keyid = "80420F66"
14 $repository_root = "/distrib/bootstrap"
15 $mirror_root = "/distrib/mirror"
16 $maintdb_url = 'http://www.maintdb2.mageia.org.uk/maintainers_packages/create'
17 # FIXME: Test password. Real password should be in extdata.
18 $maintdb_key = 'm1g234'
19 $packagers_group = 'mga-packagers'
20 $createsrpm_path = '/usr/share/repsys/create-srpm'
21
22 include ssh::auth
23 ssh::auth::key { $build_login: # declare a key for build bot: RSA, 2048 bits
24 home => $build_home_dir,
25 }
26 ssh::auth::key { $sched_login: # declare a key for sched bot: RSA, 2048 bits
27 home => $sched_home_dir,
28 }
29 }
30
31 class mainnode inherits base {
32 include iurtuser
33
34 sshuser { $sched_login:
35 homedir => $sched_home_dir,
36 comment => "System user used to schedule builds",
37 }
38
39 ssh::auth::client { $sched_login: }
40 ssh::auth::server { $sched_login: }
41 ssh::auth::server { $build_login: }
42
43 # FIXME Add again task-bs-cluster-main when it will require mgarepo instead of repsys
44 $package_list = ['iurt']
45 package { $package_list:
46 ensure => "installed"
47 }
48
49 apache::vhost_other_app { "repository.$domain":
50 vhost_file => "buildsystem/vhost_repository.conf",
51 }
52
53 $location = "/var/www/bs"
54 apache::vhost_base { "pkgsubmit.$domain":
55 aliases => { "/uploads" => "$sched_home_dir/uploads" },
56 location => $location,
57 content => template("buildsystem/vhost_pkgsubmit.conf"),
58 }
59
60 subversion::snapshot { $location:
61 source => "svn://svn.$domain/soft/buildsystem/web/",
62 }
63
64 include scheduler
65 include gatherer
66 include mgarepo
67 include youri_submit
68 include check_missing_deps
69 include signbot
70 }
71
72 class buildnode inherits base {
73 include iurt
74 }
75
76 class signbot {
77 sshuser { $sign_login:
78 homedir => $sign_home_dir,
79 comment => "System user used to sign packages",
80 groups => [$sched_login],
81 }
82
83 gnupg::keys{"packages":
84 email => "packages@$domain",
85 #FIXME there should be a variable somewhere to change the name of the distribution
86 key_name => 'Mageia Packages',
87 login => $sign_login,
88 batchdir => "$sign_home_dir/batches",
89 keydir => $sign_keydir,
90 }
91
92 gnupg::keys{"software":
93 email => "software@$domain",
94 #FIXME there should be a variable somewhere to change the name of the distribution
95 key_name => 'Mageia Software',
96 login => $sign_login,
97 batchdir => "$sign_home_dir/batches",
98 keydir => $sign_keydir,
99 }
100
101 sudo::sudoers_config { "signpackage":
102 content => template("buildsystem/sudoers.signpackage")
103 }
104
105 file { "$sign_home_dir/.rpmmacros":
106 ensure => present,
107 owner => root,
108 group => root,
109 mode => 644,
110 content => template("buildsystem/signbot-rpmmacros")
111 }
112
113 file { "/usr/local/bin/sign-check-package":
114 ensure => present,
115 owner => root,
116 group => root,
117 mode => 755,
118 content => template("buildsystem/sign-check-package")
119 }
120 }
121
122 class scheduler {
123 # ulri
124 include iurtupload
125 }
126
127 class gatherer {
128 # emi
129 include iurtupload
130 }
131
132 class iurtupload {
133 file { "/etc/iurt/upload.conf":
134 ensure => present,
135 owner => $build_login,
136 group => $build_login,
137 mode => 644,
138 require => File["/etc/iurt"],
139 content => template("buildsystem/upload.conf")
140 }
141 }
142
143 class mgarepo {
144 package { 'mgarepo':
145
146 }
147
148 package { 'rpm-build':
149 }
150
151 file { "repsys.conf":
152 path => "/etc/repsys.conf",
153 owner => root,
154 group => root,
155 mode => 644,
156 content => template("buildsystem/repsys.conf")
157 }
158
159 file { "$packages_archivedir":
160 ensure => "directory",
161 owner => $sched_login,
162 require => File[$sched_home_dir],
163 }
164
165 file { "$sched_home_dir/repsys":
166 ensure => "directory",
167 owner => $sched_login,
168 require => File[$sched_home_dir],
169 }
170
171 file { ["$sched_home_dir/repsys/tmp", "$sched_home_dir/repsys/srpms"]:
172 ensure => "directory",
173 owner => $sched_login,
174 group => "mga-packagers",
175 mode => 1775,
176 require => File["$sched_home_dir/repsys"],
177 }
178
179 # FIXME: disabled temporarly as upload dir is a symlink to /var/lib/repsys/uploads
180 #file { "$sched_home_dir/uploads":
181 # ensure => "directory",
182 # owner => $sched_login,
183 # require => File[$sched_home_dir],
184 #}
185
186 # too tedious to create everything by hand
187 # so I prefered to used some puppet ruby module
188 # the exact content and directory name should IMHO be consolidated somewhere
189 import "create_upload_dir.rb"
190 create_upload_dir { "$sched_home_dir/uploads":
191 owner => $sched_login,
192 group => $sched_login,
193 }
194
195 tidy { "$sched_home_dir/uploads":
196 age => "2w",
197 recurse => true,
198 type => "ctime",
199 }
200
201 tidy { "$packages_archivedir":
202 age => "1w",
203 matches => "*.rpm",
204 recurse => true,
205 type => "ctime",
206 }
207 }
208
209 class youri_submit {
210 include sudo
211
212 file { "/usr/local/bin/mga-youri-submit":
213 owner => root,
214 group => root,
215 mode => 755,
216 content => template("buildsystem/mga-youri-submit")
217 }
218
219 file { "/usr/local/bin/mga-youri-submit.wrapper":
220 owner => root,
221 group => root,
222 mode => 755,
223 content => template("buildsystem/mga-youri-submit.wrapper")
224 }
225
226 sudo::sudoers_config { "mga-youri-submit":
227 content => template("buildsystem/sudoers.youri")
228 }
229
230 file { "/etc/youri":
231 ensure => "directory",
232 }
233
234 file { "/etc/youri/submit-todo.conf":
235 ensure => present,
236 mode => 644,
237 require => File["/etc/youri"],
238 content => template("buildsystem/submit-todo.conf")
239 }
240
241 file { "/etc/youri/submit-upload.conf":
242 ensure => present,
243 mode => 644,
244 require => File["/etc/youri"],
245 content => template("buildsystem/submit-upload.conf")
246 }
247
248 file { "/etc/youri/acl.conf":
249 ensure => present,
250 mode => 644,
251 require => File["/etc/youri"],
252 content => template("buildsystem/youri_acl.conf")
253 }
254
255 file { '/usr/local/bin/submit_package':
256 ensure => present,
257 mode => 755,
258 content => template('buildsystem/submit_package')
259 }
260
261 # FIXME use the correct perl directory
262 file { "/usr/lib/perl5/site_perl/5.10.1/Youri/Repository":
263 ensure => "directory",
264 }
265
266 file { '/usr/lib/perl5/site_perl/5.10.1/Youri/Repository/Mageia.pm':
267 ensure => present,
268 mode => 644,
269 require => File["/usr/lib/perl5/site_perl/5.10.1/Youri/Repository"],
270 source => "puppet:///modules/buildsystem/Mageia.pm",
271 }
272
273 $package_list = ['perl-SVN', 'mdv-distrib-tools', 'perl-Youri-Media',
274 'perl-Youri-Package', 'perl-Youri-Repository',
275 'perl-Youri-Utils', 'perl-Youri-Config', 'mga-youri-submit']
276
277 package { $package_list:
278 ensure => installed;
279 }
280 }
281
282 # $groups: array of secondary groups (only local groups, no ldap)
283 define sshuser($homedir, $comment, $groups = []) {
284 group {"$title":
285 ensure => present,
286 }
287
288 user {"$title":
289 ensure => present,
290 comment => $comment,
291 managehome => true,
292 home => $homedir,
293 gid => $title,
294 groups => $groups,
295 shell => "/bin/bash",
296 notify => Exec["unlock$title"],
297 require => Group[$title],
298 }
299
300 # set password to * to unlock the account but forbid login through login
301 exec { "unlock$title":
302 command => "usermod -p '*' $title",
303 refreshonly => true,
304 }
305
306 file { $homedir:
307 ensure => "directory",
308 require => User[$title],
309 }
310
311 file { "$homedir/.ssh":
312 ensure => "directory",
313 mode => 600,
314 owner => $title,
315 group => $title,
316 require => File[$homedir],
317 }
318 }
319
320 class iurtuser {
321 sshuser { $build_login:
322 homedir => $build_home_dir,
323 comment => "System user used to run build bots",
324 }
325
326 file { "/etc/iurt":
327 ensure => "directory",
328 }
329 }
330
331 class iurt {
332 include sudo
333 include iurtuser
334 ssh::auth::client { $build_login: }
335 ssh::auth::server { $sched_login: user => $build_login }
336
337 # build node common settings
338 # we could have the following skip list to use less space:
339 # '/(drakx-installer-binaries|drakx-installer-advertising|gfxboot|drakx-installer-stage2|mandriva-theme)/'
340 $package_list = ['task-bs-cluster-chroot', 'iurt']
341 package { $package_list:
342 ensure => installed;
343 }
344
345 file { "/etc/iurt/build":
346 ensure => "directory",
347 require => File["/etc/iurt"],
348 }
349
350 file { "/etc/iurt/build/cauldron.conf":
351 ensure => present,
352 owner => $build_login,
353 group => $build_login,
354 mode => 644,
355 require => File["/etc/iurt/build"],
356 content => template("buildsystem/iurt.cauldron.conf")
357 }
358
359 file { "/etc/iurt/build/mandriva2010.1.conf":
360 ensure => present,
361 owner => $build_login,
362 group => $build_login,
363 mode => 644,
364 require => File["/etc/iurt/build"],
365 content => template("buildsystem/iurt.mandriva2010.1.conf")
366 }
367
368 sudo::sudoers_config { "iurt":
369 content => template("buildsystem/sudoers.iurt")
370 }
371 }
372
373 # temporary script to create home dir with ssh key
374 # taking login and url as arguments
375 class mgacreatehome {
376 file { "/usr/local/sbin/mgacreatehome":
377 ensure => present,
378 owner => root,
379 group => root,
380 mode => 700,
381 content => template("buildsystem/mgacreatehome")
382 }
383 }
384
385 class check_missing_deps {
386 file { "/usr/local/bin/missing-deps.sh":
387 ensure => present,
388 owner => root,
389 group => root,
390 mode => 755,
391 source => "puppet:///modules/buildsystem/missing-deps.sh",
392 }
393
394 # FIXME hardcoded path
395 cron { "check missing deps":
396 command => "cd /var/www/bs/data && /usr/local/bin/missing-deps.sh",
397 minute => "*/15",
398 }
399 }
400
401 class iurt20101 inherits base {
402 file { "/usr/local/bin/iurt2010.1":
403 ensure => present,
404 owner => root,
405 group => root,
406 mode => 755,
407 content => template("buildsystem/iurt2010.1"),
408 }
409 }
410 }

  ViewVC Help
Powered by ViewVC 1.1.30