summaryrefslogtreecommitdiff
path: root/modules/shiori/manifests/init.pp
blob: 69d5fde53311f6530b00e6d8cc3f8bc9eaa1c079 (plain)
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
class shiori (
  $port = 8080,
  $dir = '/var/www/shiori',
) {


  # on arch this is available through the aur
  package { 'shiori-bin':
    ensure => installed,
  }

  user { 'shiori':
    ensure => present,
    system => true,
    home   => $dir,
  }

  file { $dir:
    ensure => directory,
    owner  => shiori,
    group  => shiori,
    mode   => '0750',
  }

  file { [
    "${dir}/archive",
    "${dir}/thumb",
  ] :
    ensure => directory,
    owner  => shiori,
    group  => shiori,
    mode   => '0770',
  }

  file { "${dir}/shiori.db":
    owner => 'shiori',
    group => 'shiori',
    mode  => '0660',
  }

  file { '/etc/systemd/system/shiori.service':
    ensure => file,
    source => 'puppet:///modules/shiori/shiori.service',
  }

  file { '/etc/conf.d/shiori':
    ensure  => 'file',
    content => @("EOF")
      # This file is managed by Puppet.
      PORT=${port}
      SHIORI_DIR=${dir}
      | EOF
  }

  service { 'shiori':
    ensure  => running,
    enable  => true,
    require => [
      File['/etc/systemd/system/shiori.service'],
      File['/etc/conf.d/shiori'],
    ],
  }

  # Users could be managed here, through shioris HTTP API
}