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