1 |
class mga-treasurer( |
2 |
$grisbi_svn = 'svn://svn.mageia.org/svn/treasurer/grisbi', |
3 |
$grisbi_filename = 'mageia-accounts.gsb', |
4 |
$vhost, |
5 |
$vhostdir |
6 |
){ |
7 |
$mgatres_login = 'mga-treasurer' |
8 |
$mgatres_homedir = "/var/lib/${mgatres_login}" |
9 |
$grisbi_dir = "${mgatres_homedir}/grisbi" |
10 |
$grisbi_path = "${grisbi_dir}/${grisbi_filename}" |
11 |
|
12 |
$update_script = '/usr/local/bin/update_mga-treasurer' |
13 |
|
14 |
group { $mgatres_login: |
15 |
ensure => present, |
16 |
} |
17 |
|
18 |
user { $mgatres_login: |
19 |
ensure => present, |
20 |
comment => 'mga-treasurer user', |
21 |
home => $mgatres_homedir, |
22 |
managehome => true, |
23 |
gid => $mgatres_login, |
24 |
} |
25 |
|
26 |
package { 'mga-treasurer': |
27 |
ensure => installed, |
28 |
} |
29 |
|
30 |
file {'/etc/mga-treasurer.conf': |
31 |
ensure => present, |
32 |
owner => root, |
33 |
group => root, |
34 |
mode => '0644', |
35 |
content => template('mga-treasurer/mga-treasurer.conf'), |
36 |
require => Package['mga-treasurer'], |
37 |
} |
38 |
|
39 |
file { $vhostdir: |
40 |
ensure => directory, |
41 |
owner => $mgatres_login, |
42 |
group => $mgatres_login, |
43 |
mode => '0755', |
44 |
} |
45 |
|
46 |
apache::vhost::base { $vhost: |
47 |
location => $vhostdir, |
48 |
aliases => { |
49 |
"/${grisbi_filename}" => $grisbi_path, |
50 |
"/static" => '/usr/share/mga-treasurer/static', |
51 |
}, |
52 |
require => File[$vhostdir], |
53 |
} |
54 |
|
55 |
file { $update_script: |
56 |
ensure => present, |
57 |
owner => root, |
58 |
group => root, |
59 |
mode => '0755', |
60 |
content => template('mga-treasurer/update_script'), |
61 |
} |
62 |
|
63 |
subversion::snapshot { $grisbi_dir: |
64 |
source => $grisbi_svn, |
65 |
user => $mgatres_login, |
66 |
refresh => '0', |
67 |
require => User[$mgatres_login], |
68 |
} |
69 |
|
70 |
cron { $update_script: |
71 |
command => $update_script, |
72 |
user => $mgatres_login, |
73 |
hour => '*/2', |
74 |
minute => '10', |
75 |
require => Subversion::Snapshot[$grisbi_dir], |
76 |
} |
77 |
} |
78 |
# vim: sw=2 |