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