Puppet Class: freebsd_deluge

Defined in:
manifests/init.pp

Overview



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
# File 'manifests/init.pp', line 6

class freebsd_deluge {
  package { 'deluge-cli':
    ensure  => latest,
    require => User['deluge'],
  }
  package { 'deluge-web':
    ensure  => absent,
    require => User['deluge'],
  }
  package { 'py27-service_identity':
    ensure => installed,
  }
  file { '/usr/local/etc/rc.d/deluged':
    owner   => 'root',
    group   => 'wheel',
    mode    => '0755',
    source  => 'puppet:///modules/freebsd_deluge_light/deluged_init.sh',
    require => User['deluge'],
  }
  user { 'deluge':
    ensure  => present,
    groups  => 'deluge',
    comment => 'deluge user',
    home    => '/home/deluge',
    shell   => '/bin/sh',
    require => Group['deluge'],
  }

  group { 'deluge':
    ensure => present,
  }

  file { '/home/deluge':
    ensure  => directory,
    owner   => 'deluge',
    group   => 'deluge',
    mode    => '0744',
    require => User['deluge']
  }
  exec { 'delfirstrun':
    command => '/usr/local/bin/deluged',
    path    => '/usr/bin:/usr/sbin:/bin:/usr/local/bin',
    user    => 'deluge',
    require => User['deluge'],
    before  => File['/home/deluge/.config/deluge/auth'],
    unless  => 'test -f /home/deluge/.config/',
  }

  file { '/home/deluge/.config/deluge/auth':
    owner   => 'deluge',
    group   => 'deluge',
    mode    => '0600',
    source  => 'puppet:///modules/freebsd_deluge_light/auth',
    require => File['/home/deluge'],
  }
  file { '/home/deluge/.config/deluge/core.conf':
    owner   => 'deluge',
    group   => 'deluge',
    mode    => '0600',
    source  => 'puppet:///modules/freebsd_deluge_light/core.conf',
    require => File['/home/deluge'],
  }
  exec { 'addtorc':
    command => 'echo deluged_enable=\"YES\" >> /etc/rc.conf && touch /usr/local/etc/deluged_enable.txt',
    path    => '/usr/bin:/usr/sbin:/bin:/usr/local/bin',
    unless  => 'test -f /usr/local/etc/deluged_enable.txt',
  }
  zfs::create { 'zroot/torrents':
    ensure     => present,
    filesystem => '/torrents',
  }
  zfs::create { 'zroot/torrents/downloading':
    ensure     => present,
    filesystem => '/torrents/downloading',
    require    => Zfs::Create['zroot/torrents'],
  }
  zfs::create { 'zroot/torrents/files':
    ensure     => present,
    filesystem => '/torrents/files',
    require    => Zfs::Create['zroot/torrents'],
  }
  zfs::create { 'zroot/torrents/completed':
    ensure     => present,
    filesystem => '/torrents/completed',
    require    => Zfs::Create['zroot/torrents'],
  }
  exec { 'zfsperms':
    command => 'chown -R deluge:deluge /torrents',
    path    => '/usr/bin:/usr/sbin:/bin:/usr/local/bin',
    require => [Zfs::Create['zroot/torrents'], Zfs::Create['zroot/torrents/downloading'], Zfs::Create['zroot/torrents/files'], Zfs::Create['zroot/torrents/completed']],
  }
}