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