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