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 |
sudo::sudoers_config { "signpackage": |
93 |
content => template("buildsystem/sudoers.signpackage") |
94 |
} |
95 |
|
96 |
file { "$sign_home_dir/.rpmmacros": |
97 |
ensure => present, |
98 |
owner => root, |
99 |
group => root, |
100 |
mode => 644, |
101 |
content => template("buildsystem/signbot-rpmmacros") |
102 |
} |
103 |
|
104 |
file { "/usr/local/bin/sign-check-package": |
105 |
ensure => present, |
106 |
owner => root, |
107 |
group => root, |
108 |
mode => 755, |
109 |
content => template("buildsystem/sign-check-package") |
110 |
} |
111 |
} |
112 |
|
113 |
class scheduler { |
114 |
# ulri |
115 |
include iurtupload |
116 |
} |
117 |
|
118 |
class gatherer { |
119 |
# emi |
120 |
include iurtupload |
121 |
} |
122 |
|
123 |
class iurtupload { |
124 |
file { "/etc/iurt/upload.conf": |
125 |
ensure => present, |
126 |
owner => $build_login, |
127 |
group => $build_login, |
128 |
mode => 644, |
129 |
require => File["/etc/iurt"], |
130 |
content => template("buildsystem/upload.conf") |
131 |
} |
132 |
} |
133 |
|
134 |
class mgarepo { |
135 |
package { 'mgarepo': |
136 |
|
137 |
} |
138 |
|
139 |
package { 'rpm-build': |
140 |
} |
141 |
|
142 |
file { "repsys.conf": |
143 |
path => "/etc/repsys.conf", |
144 |
owner => root, |
145 |
group => root, |
146 |
mode => 644, |
147 |
content => template("buildsystem/repsys.conf") |
148 |
} |
149 |
|
150 |
file { "$packages_archivedir": |
151 |
ensure => "directory", |
152 |
owner => $sched_login, |
153 |
require => File[$sched_home_dir], |
154 |
} |
155 |
|
156 |
file { "$sched_home_dir/repsys": |
157 |
ensure => "directory", |
158 |
owner => $sched_login, |
159 |
require => File[$sched_home_dir], |
160 |
} |
161 |
|
162 |
file { ["$sched_home_dir/repsys/tmp", "$sched_home_dir/repsys/srpms"]: |
163 |
ensure => "directory", |
164 |
owner => $sched_login, |
165 |
group => "mga-packagers", |
166 |
mode => 1775, |
167 |
require => File["$sched_home_dir/repsys"], |
168 |
} |
169 |
|
170 |
# FIXME: disabled temporarly as upload dir is a symlink to /var/lib/repsys/uploads |
171 |
#file { "$sched_home_dir/uploads": |
172 |
# ensure => "directory", |
173 |
# owner => $sched_login, |
174 |
# require => File[$sched_home_dir], |
175 |
#} |
176 |
|
177 |
# too tedious to create everything by hand |
178 |
# so I prefered to used some puppet ruby module |
179 |
# the exact content and directory name should IMHO be consolidated somewhere |
180 |
import "create_upload_dir.rb" |
181 |
create_upload_dir { "$sched_home_dir/uploads": |
182 |
owner => $sched_login, |
183 |
group => $sched_login, |
184 |
} |
185 |
|
186 |
tidy { "$sched_home_dir/uploads/": |
187 |
age => "2w", |
188 |
recurse => true, |
189 |
type => "ctime", |
190 |
} |
191 |
|
192 |
tidy { "$packages_archivedir": |
193 |
age => "1w", |
194 |
matches => "*.rpm", |
195 |
recurse => true, |
196 |
type => "ctime", |
197 |
} |
198 |
} |
199 |
|
200 |
class youri_submit { |
201 |
include sudo |
202 |
|
203 |
file { "/usr/local/bin/mga-youri-submit": |
204 |
owner => root, |
205 |
group => root, |
206 |
mode => 755, |
207 |
content => template("buildsystem/mga-youri-submit") |
208 |
} |
209 |
|
210 |
file { "/usr/local/bin/mga-youri-submit.wrapper": |
211 |
owner => root, |
212 |
group => root, |
213 |
mode => 755, |
214 |
content => template("buildsystem/mga-youri-submit.wrapper") |
215 |
} |
216 |
|
217 |
sudo::sudoers_config { "mga-youri-submit": |
218 |
content => template("buildsystem/sudoers.youri") |
219 |
} |
220 |
|
221 |
file { "/etc/youri": |
222 |
ensure => "directory", |
223 |
} |
224 |
|
225 |
file { "/etc/youri/submit-todo.conf": |
226 |
ensure => present, |
227 |
mode => 644, |
228 |
require => File["/etc/youri"], |
229 |
content => template("buildsystem/submit-todo.conf") |
230 |
} |
231 |
|
232 |
file { "/etc/youri/submit-upload.conf": |
233 |
ensure => present, |
234 |
mode => 644, |
235 |
require => File["/etc/youri"], |
236 |
content => template("buildsystem/submit-upload.conf") |
237 |
} |
238 |
|
239 |
file { "/etc/youri/acl.conf": |
240 |
ensure => present, |
241 |
mode => 644, |
242 |
require => File["/etc/youri"], |
243 |
content => template("buildsystem/youri_acl.conf") |
244 |
} |
245 |
|
246 |
file { '/usr/local/bin/submit_package': |
247 |
ensure => present, |
248 |
mode => 755, |
249 |
content => template('buildsystem/submit_package') |
250 |
} |
251 |
|
252 |
# FIXME use the correct perl directory |
253 |
file { "/usr/lib/perl5/site_perl/5.10.1/Youri/Repository": |
254 |
ensure => "directory", |
255 |
} |
256 |
|
257 |
file { '/usr/lib/perl5/site_perl/5.10.1/Youri/Repository/Mageia.pm': |
258 |
ensure => present, |
259 |
mode => 644, |
260 |
require => File["/usr/lib/perl5/site_perl/5.10.1/Youri/Repository"], |
261 |
source => "puppet:///modules/buildsystem/Mageia.pm", |
262 |
} |
263 |
|
264 |
$package_list = ['perl-SVN', 'mdv-distrib-tools', 'perl-Youri-Media', |
265 |
'perl-Youri-Package', 'perl-Youri-Repository', |
266 |
'perl-Youri-Utils', 'perl-Youri-Config', 'mga-youri-submit'] |
267 |
|
268 |
package { $package_list: |
269 |
ensure => installed; |
270 |
} |
271 |
} |
272 |
|
273 |
# $groups: array of secondary groups (only local groups, no ldap) |
274 |
define sshuser($homedir, $comment, $groups = []) { |
275 |
group {"$title": |
276 |
ensure => present, |
277 |
} |
278 |
|
279 |
user {"$title": |
280 |
ensure => present, |
281 |
comment => $comment, |
282 |
managehome => true, |
283 |
home => $homedir, |
284 |
gid => $title, |
285 |
groups => $groups, |
286 |
shell => "/bin/bash", |
287 |
notify => Exec["unlock$title"], |
288 |
require => Group[$title], |
289 |
} |
290 |
|
291 |
# set password to * to unlock the account but forbid login through login |
292 |
exec { "unlock$title": |
293 |
command => "usermod -p '*' $title", |
294 |
refreshonly => true, |
295 |
} |
296 |
|
297 |
file { $homedir: |
298 |
ensure => "directory", |
299 |
require => User[$title], |
300 |
} |
301 |
|
302 |
file { "$homedir/.ssh": |
303 |
ensure => "directory", |
304 |
mode => 600, |
305 |
owner => $title, |
306 |
group => $title, |
307 |
require => File[$homedir], |
308 |
} |
309 |
} |
310 |
|
311 |
class iurtuser { |
312 |
sshuser { $build_login: |
313 |
homedir => $build_home_dir, |
314 |
comment => "System user used to run build bots", |
315 |
} |
316 |
|
317 |
file { "/etc/iurt": |
318 |
ensure => "directory", |
319 |
} |
320 |
} |
321 |
|
322 |
class iurt { |
323 |
include sudo |
324 |
include iurtuser |
325 |
ssh::auth::client { $build_login: } |
326 |
ssh::auth::server { $sched_login: user => $build_login } |
327 |
|
328 |
# build node common settings |
329 |
# we could have the following skip list to use less space: |
330 |
# '/(drakx-installer-binaries|drakx-installer-advertising|gfxboot|drakx-installer-stage2|mandriva-theme)/' |
331 |
$package_list = ['task-bs-cluster-chroot', 'iurt'] |
332 |
package { $package_list: |
333 |
ensure => installed; |
334 |
} |
335 |
|
336 |
file { "/etc/iurt/build": |
337 |
ensure => "directory", |
338 |
require => File["/etc/iurt"], |
339 |
} |
340 |
|
341 |
file { "/etc/iurt/build/cauldron.conf": |
342 |
ensure => present, |
343 |
owner => $build_login, |
344 |
group => $build_login, |
345 |
mode => 644, |
346 |
require => File["/etc/iurt/build"], |
347 |
content => template("buildsystem/iurt.cauldron.conf") |
348 |
} |
349 |
|
350 |
file { "/etc/iurt/build/mandriva2010.1.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.mandriva2010.1.conf") |
357 |
} |
358 |
|
359 |
sudo::sudoers_config { "iurt": |
360 |
content => template("buildsystem/sudoers.iurt") |
361 |
} |
362 |
} |
363 |
|
364 |
# temporary script to create home dir with ssh key |
365 |
# taking login and url as arguments |
366 |
class mgacreatehome { |
367 |
file { "/usr/local/sbin/mgacreatehome": |
368 |
ensure => present, |
369 |
owner => root, |
370 |
group => root, |
371 |
mode => 700, |
372 |
content => template("buildsystem/mgacreatehome") |
373 |
} |
374 |
} |
375 |
|
376 |
class check_missing_deps { |
377 |
file { "/usr/local/bin/missing-deps.sh": |
378 |
ensure => present, |
379 |
owner => root, |
380 |
group => root, |
381 |
mode => 755, |
382 |
source => "puppet:///modules/buildsystem/missing-deps.sh", |
383 |
} |
384 |
|
385 |
# FIXME hardcoded path |
386 |
cron { "check missing deps": |
387 |
command => "cd /var/www/bs/data && /usr/local/bin/missing-deps.sh", |
388 |
minute => "*/15", |
389 |
} |
390 |
} |
391 |
|
392 |
class iurt20101 inherits base { |
393 |
file { "/usr/local/bin/iurt2010.1": |
394 |
ensure => present, |
395 |
owner => root, |
396 |
group => root, |
397 |
mode => 755, |
398 |
content => template("buildsystem/iurt2010.1"), |
399 |
} |
400 |
} |
401 |
} |