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