aboutsummaryrefslogtreecommitdiff
path: root/manifests/init.pp
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/init.pp')
-rw-r--r--manifests/init.pp145
1 files changed, 145 insertions, 0 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
new file mode 100644
index 0000000..c06db0d
--- /dev/null
+++ b/manifests/init.pp
@@ -0,0 +1,145 @@
+class pysocope($password = hiera('pyroscope::password' = '')) {
+ case $password {
+ '': { fail("You need to define torrent user password! Please set pyroscope::password in your config") }
+ }
+
+ user::manage { "torrent":
+ password => $password,
+ homedir => '/var/cache/torrent',
+ ensure => present,
+ groups => [ 'incoming' ],
+ }
+
+ file { '/var/cache/media/seeding':
+ ensure => directory,
+ owner => torrent,
+ group => torrent,
+ mode => 0755,
+ require => [ File['/var/cache/media'], User['torrent'] ],
+ }
+
+ file { '/var/cache/torrent/.profile':
+ ensure => present,
+ owner => torrent,
+ group => torrent,
+ mode => 0644,
+ source => 'puppet:///modules/pyroscope/profile.sh',
+ require => User['torrent'],
+ }
+
+ file { '/var/cache/torrent/.bashrc':
+ ensure => present,
+ owner => torrent,
+ group => torrent,
+ mode => 0644,
+ source => 'puppet:///modules/pyroscope/bashrc.sh',
+ require => User['torrent'],
+ }
+
+ file { '/var/cache/torrent/rtorrent':
+ ensure => directory,
+ owner => torrent,
+ group => torrent,
+ mode => 0755,
+ require => User['torrent'],
+ }
+
+ file { '/var/cache/torrent/rtorrent/done':
+ ensure => '/var/cache/media/incoming',
+ owner => torrent,
+ group => torrent,
+ require => File['/var/cache/torrent/rtorrent'],
+ }
+
+ file { '/var/cache/torrent/rtorrent/seeding':
+ ensure => '/var/cache/media/seeding',
+ owner => torrent,
+ group => torrent,
+ require => File['/var/cache/torrent/rtorrent'],
+ }
+
+ file { [ '/var/cache/torrent/rtorrent/log', '/var/cache/torrent/rtorrent/.session' ]:
+ ensure => directory,
+ owner => torrent,
+ group => torrent,
+ mode => 0755,
+ require => File['/var/cache/torrent/rtorrent'],
+ }
+
+ file { '/var/cache/torrent/rtorrent/rtorrent.rc':
+ ensure => present,
+ owner => torrent,
+ group => torrent,
+ mode => 0644,
+ source => 'puppet:///modules/pyroscope/rtorrent.rc',
+ require => File['/var/cache/torrent/rtorrent'],
+ }
+
+ file { '/var/cache/torrent/rtorrent/start':
+ ensure => present,
+ owner => torrent,
+ group => torrent,
+ mode => 0755,
+ source => 'puppet:///modules/pyroscope/start.sh',
+ require => File['/var/cache/torrent/rtorrent'],
+ }
+
+ file { '/var/cache/torrent/.pyroscope':
+ ensure => directory,
+ owner => torrent,
+ group => torrent,
+ mode => 0755,
+ require => User['torrent'],
+ }
+
+ file { '/var/cache/torrent/.pyroscope/run':
+ ensure => directory,
+ owner => torrent,
+ group => torrent,
+ mode => 0755,
+ require => File['/var/cache/torrent/.pyroscope'],
+ }
+
+ file { '/var/cache/torrent/.pyroscope/run/pyrotorque':
+ ensure => present,
+ owner => torrent,
+ group => torrent,
+ mode => 0644,
+ require => File['/var/cache/torrent/.pyroscope/run'],
+ }
+
+ file { '/var/cache/torrent/.pyroscope/torque.ini':
+ ensure => present,
+ owner => torrent,
+ group => torrent,
+ mode => 0644,
+ source => 'puppet:///modules/pyroscope/torque.ini',
+ require => File['/var/cache/torrent/.pyroscope'],
+ }
+
+ file { '/var/cache/torrent/bin':
+ ensure => directory,
+ owner => torrent,
+ group => torrent,
+ mode => 0755,
+ require => User['torrent'],
+ }
+
+ file { '/var/cache/torrent/bin/rtcron':
+ ensure => present,
+ owner => torrent,
+ group => torrent,
+ mode => 0755,
+ source => 'puppet:///modules/pyroscope/rtcron.sh',
+ require => File['/var/cache/torrent/bin'],
+ }
+
+ cron { "rtcron":
+ command => '/var/cache/torrent/bin/rtcron &> /var/cache/torrent/rtorrent/log/rtcron.log',
+ user => torrent,
+ hour => "*",
+ minute => "*",
+ ensure => present,
+ require => File['/var/cache/torrent/bin/rtcron'],
+ }
+}