1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
|
class pyroscope(
$password = lookup('pyroscope::password', undef, undef, ''),
$homedir = lookup('pyroscope::homedir', undef, undef, '/var/cache/torrent'),
$groups = lookup('pyroscope::groups', undef, undef, [ 'incoming' ]),
) {
case $password {
'': { fail("You need to define torrent user password! Please set pyroscope::password in your config") }
}
include pyroscope::dependencies
user::manage { "torrent":
password => $password,
homedir => $homedir,
ensure => present,
groups => $groups,
}
file { '/var/cache/media/seeding':
ensure => directory,
owner => torrent,
group => torrent,
mode => '0775',
require => [ File['/var/cache/media'], User['torrent'] ],
}
file { "${homedir}/.profile":
ensure => present,
owner => torrent,
group => torrent,
mode => '0644',
source => 'puppet:///modules/pyroscope/profile.sh',
require => User['torrent'],
}
file { "${homedir}/.bashrc":
ensure => present,
owner => torrent,
group => torrent,
mode => '0644',
source => 'puppet:///modules/pyroscope/bashrc.sh',
require => User['torrent'],
}
file { "${homedir}/rtorrent":
ensure => directory,
owner => torrent,
group => torrent,
mode => '0755',
require => User['torrent'],
}
file { "${homedir}/rtorrent/done":
ensure => '/var/cache/media/incoming',
owner => torrent,
group => torrent,
require => File["${homedir}/rtorrent"],
}
file { "${homedir}/rtorrent/seeding":
ensure => '/var/cache/media/seeding',
owner => torrent,
group => torrent,
require => File["${homedir}/rtorrent"],
}
file { [ "${homedir}/rtorrent/log", "${homedir}/rtorrent/.session" ]:
ensure => directory,
owner => torrent,
group => torrent,
mode => '0755',
require => File["${homedir}/rtorrent"],
}
file { "${homedir}/rtorrent/rtorrent.rc":
ensure => present,
owner => torrent,
group => torrent,
mode => '0644',
source => [ 'puppet:///modules/site_pyroscope/rtorrent.rc',
'puppet:///modules/pyroscope/rtorrent.rc', ],
require => File["${homedir}/rtorrent"],
}
file { "${homedir}/.rtorrent.rc":
ensure => "${homedir}/rtorrent/rtorrent.rc",
owner => torrent,
group => torrent,
require => File["${homedir}/rtorrent/rtorrent.rc"],
}
file { "${homedir}/rtorrent/start":
ensure => present,
owner => torrent,
group => torrent,
mode => '0755',
source => 'puppet:///modules/pyroscope/start.sh',
require => File["${homedir}/rtorrent"],
}
file { "${homedir}/.pyroscope":
ensure => directory,
owner => torrent,
group => torrent,
mode => '0755',
require => User['torrent'],
}
file { "${homedir}/.pyroscope/run":
ensure => directory,
owner => torrent,
group => torrent,
mode => '0755',
require => File["${homedir}/.pyroscope"],
}
file { "${homedir}/.pyroscope/run/pyrotorque":
ensure => present,
owner => torrent,
group => torrent,
mode => '0644',
require => File["${homedir}/.pyroscope/run"],
}
file { "${homedir}/.pyroscope/torque.ini":
ensure => present,
owner => torrent,
group => torrent,
mode => '0644',
source => 'puppet:///modules/pyroscope/torque.ini',
require => File["${homedir}/.pyroscope"],
}
file { [ "${homedir}/bin", "${homedir}/lib", "${homedir}/src" ]:
ensure => directory,
owner => torrent,
group => torrent,
mode => '0755',
require => User['torrent'],
}
file { "${homedir}/bin/rtcron":
ensure => present,
owner => torrent,
group => torrent,
mode => '0755',
source => 'puppet:///modules/pyroscope/rtcron.sh',
require => File["${homedir}/bin"],
}
cron { "rtcron":
command => "${homedir}/bin/rtcron > ${homedir}/rtorrent/log/rtcron.log 2>&1",
user => torrent,
hour => "*",
minute => "*",
ensure => present,
require => File["${homedir}/bin/rtcron"],
}
vcsrepo { "${homedir}/lib/pyroscope":
ensure => present,
provider => git,
source => 'https://github.com/pyroscope/pyrocore.git',
revision => '7da621848e24c1a0f897be8065045dd49ef9f8bb',
owner => 'torrent',
group => 'torrent',
require => [ User['torrent'], File["${homedir}/lib"] ],
}
vcsrepo { "${homedir}/src/rtorrent-ps":
ensure => present,
provider => git,
source => 'https://github.com/pyroscope/rtorrent-ps.git',
revision => 'b51bdba86b8b6331f6281fbbcab2cae7329bcaa9',
owner => 'torrent',
group => 'torrent',
require => [ User['torrent'], File["${homedir}/src"] ],
}
exec { 'pyroscope-update-to-head':
command => "${homedir}/lib/pyroscope/update-to-head.sh",
user => torrent,
timeout => 0,
creates => "${homedir}/bin/pyroadmin",
require => [ Class['pyroscope::dependencies'], Vcsrepo["${homedir}/lib/pyroscope"] ],
}
exec { 'pyroscope-rtorrent-ps-build':
command => './build.sh all && ./build.sh extend',
cwd => "${homedir}/src/rtorrent-ps",
user => torrent,
timeout => 0,
creates => "${homedir}/bin/rtorrent",
require => [ Class['pyroscope::dependencies'], Vcsrepo["${homedir}/src/rtorrent-ps"] ],
}
}
|