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 |
|
9 |
include ssh::auth |
10 |
ssh::auth::key { $build_login: } # declare a key for build bot: RSA, 2048 bits |
11 |
ssh::auth::key { $sched_login: } # declare a key for sched bot: RSA, 2048 bits |
12 |
} |
13 |
|
14 |
class mainnode inherits base { |
15 |
include iurtuser |
16 |
ssh::auth::server { $build_login: } |
17 |
|
18 |
sshuser { $sched_login: |
19 |
homedir => $sched_home_dir, |
20 |
comment => "System user used to schedule builds", |
21 |
} |
22 |
|
23 |
package { "task-bs-cluster-main": |
24 |
ensure => "installed" |
25 |
} |
26 |
} |
27 |
|
28 |
class buildnode inherits base { |
29 |
include iurt |
30 |
} |
31 |
|
32 |
class scheduler { |
33 |
# ulri |
34 |
} |
35 |
|
36 |
class dispatcher { |
37 |
# emi |
38 |
} |
39 |
|
40 |
class repsys { |
41 |
package { 'repsys': |
42 |
|
43 |
} |
44 |
|
45 |
|
46 |
} |
47 |
|
48 |
define sshuser($homedir, $comment) { |
49 |
group {"$title": |
50 |
ensure => present, |
51 |
} |
52 |
|
53 |
user {"$title": |
54 |
ensure => present, |
55 |
comment => $comment, |
56 |
managehome => true, |
57 |
gid => $title, |
58 |
shell => "/bin/bash", |
59 |
notify => Exec["unlock$title"], |
60 |
} |
61 |
|
62 |
# set password to * to unlock the account but forbid login through login |
63 |
exec { "unlock$title": |
64 |
command => "usermod -p '*' $title", |
65 |
refreshonly => true, |
66 |
} |
67 |
|
68 |
file { $homedir: |
69 |
ensure => "directory", |
70 |
} |
71 |
|
72 |
file { "$homedir/.ssh": |
73 |
ensure => "directory", |
74 |
mode => 600, |
75 |
owner => $title, |
76 |
group => $title, |
77 |
} |
78 |
} |
79 |
|
80 |
class iurtuser { |
81 |
sshuser { $build_login: |
82 |
homedir => $build_home_dir, |
83 |
comment => "System user used to run build bots", |
84 |
} |
85 |
} |
86 |
|
87 |
class iurt { |
88 |
include sudo |
89 |
include iurtuser |
90 |
ssh::auth::client { $build_login: } |
91 |
|
92 |
# build node common settings |
93 |
# we could have the following skip list to use less space: |
94 |
# '/(drakx-installer-binaries|drakx-installer-advertising|gfxboot|drakx-installer-stage2|mandriva-theme)/' |
95 |
$package_list = ['task-bs-cluster-chroot', 'iurt'] |
96 |
package { $package_list: |
97 |
ensure => installed; |
98 |
} |
99 |
|
100 |
file { "$build_home_dir/.iurt.cauldron.conf": |
101 |
ensure => present, |
102 |
owner => $build_login, |
103 |
group => $build_login, |
104 |
mode => 644, |
105 |
content => template("buildsystem/iurt.cauldron.conf") |
106 |
} |
107 |
|
108 |
file { "/etc/sudoers.d/iurt": |
109 |
ensure => present, |
110 |
owner => root, |
111 |
group => root, |
112 |
mode => 440, |
113 |
content => template("buildsystem/sudoers.iurt") |
114 |
} |
115 |
} |
116 |
} |