aboutsummaryrefslogtreecommitdiffstats
path: root/modules/mga-treasurer/manifests/init.pp
blob: edd79ab6524b6e12e49e105b6754aa9a0c7423e2 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
class mga-treasurer(
  $grisbi_svn = 'svn://svn.mageia.org/svn/treasurer/grisbi',
  $grisbi_filename = 'mageia-accounts.gsb',
  $vhost,
  $vhostdir
){
  $mgatres_login = 'mga-treasurer'
  $mgatres_homedir = "/var/lib/${mgatres_login}"
  $grisbi_dir = "${mgatres_homedir}/grisbi"
  $grisbi_path = "${grisbi_dir}/${grisbi_filename}"

  $update_script = '/usr/local/bin/update_mga-treasurer'

  group { $mgatres_login:
    ensure => present,
  }

  user { $mgatres_login:
    ensure     => present,
    comment    => 'mga-treasurer user',
    home       => $mgatres_homedir,
    managehome => true,
    gid        => $mgatres_login,
  }

  package { 'mga-treasurer':
    ensure => installed,
  }

  file {'/etc/mga-treasurer.conf':
    ensure  => present,
    owner   => root,
    group   => root,
    mode    => '0644',
    content => template('mga-treasurer/mga-treasurer.conf'),
    require => Package['mga-treasurer'],
  }

  file { $vhostdir:
    ensure => directory,
    owner  => $mgatres_login,
    group  => $mgatres_login,
    mode   => '0755',
  }

  apache::vhost::base { $vhost:
    location => $vhostdir,
    aliases  => {
      "/${grisbi_filename}" => $grisbi_path,
      "/static" => '/usr/share/mga-treasurer/static',
    },
    require  => File[$vhostdir],
  }

  file { $update_script:
    ensure  => present,
    owner   => root,
    group   => root,
    mode    => '0755',
    content => template('mga-treasurer/update_script'),
  }

  subversion::snapshot { $grisbi_dir:
    source  => $grisbi_svn,
    user    => $mgatres_login,
    refresh => '0',
    require => User[$mgatres_login],
  }

  cron { $update_script:
    command => $update_script,
    user    => $mgatres_login,
    hour    => '*/2',
    minute  => '10',
    require => Subversion::Snapshot[$grisbi_dir],
  }
}
# vim: sw=2