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