/[adm]/puppet/modules/rsnapshot/manifests/init.pp
ViewVC logotype

Contents of /puppet/modules/rsnapshot/manifests/init.pp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2847 - (show annotations) (download)
Sun Sep 16 21:15:28 2012 UTC (11 years, 7 months ago) by boklm
File size: 1873 byte(s)
fix typo
1 class rsnapshot {
2 class base($confdir = '/backups/conf') {
3 package { ['rsnapshot']: }
4
5 file { $confdir:
6 ensure => directory,
7 owner => root,
8 group => root,
9 mode => 0700,
10 }
11
12 @rsnapshot::cron_file { 'hourly': }
13 @rsnapshot::cron_file { 'daily': }
14 @rsnapshot::cron_file { 'weekly': }
15 @rsnapshot::cron_file { 'monthly': }
16 }
17
18 define cron_file($rsnapshot_conf = []) {
19 $filepath = "/tmp/cron.${name}_rsnapshot-backups"
20 $rsnapshot_arg = ${name}
21 file { $filepath:
22 ensure => present,
23 content => template('rsnapshot/cron_file'),
24 owner => root,
25 group => root,
26 mode => 0755,
27 }
28 }
29
30 # - 'backup' is an array of "source destination" to backup
31 # - 'backup_script' is an array of "script destination"
32 # - ${x}_interval is the number of hourly, daily, weekly, monthly
33 # backups that should be kept. If you don't want hourly, daily,
34 # weekly or monthly backups, set ${x}_interval to '0'
35 define backup(
36 $snapshot_root = '/backups',
37 $one_fs = '1',
38 $backup = [],
39 $backup_script = [],
40 $hourly_interval = '0',
41 $daily_interval = '6',
42 $weekly_interval = '4',
43 $monthly_interval = '3'
44 ) {
45 $conffile = "${rsnapshot::base::confdir}/${name}.conf"
46 file { $conffile:
47 owner => root,
48 group => root,
49 mode => 0700,
50 content => template('rsnapshot/rsnapshot.conf'),
51 }
52
53 if ($hourly_interval != '0') {
54 Rsnapshot::Cron_file <| title == 'hourly' |> {
55 $rsnapshot_conf +> $conffile,
56 }
57 }
58 if ($daily_interval != '0') {
59 Rsnapshot::Cron_file <| title == 'daily' |> {
60 $rsnapshot_conf +> $conffile,
61 }
62 }
63 if ($weekly_interval != '0') {
64 Rsnapshot::Cron_file <| title == 'weekly' |> {
65 $rsnapshot_conf +> $conffile,
66 }
67 }
68 if ($monthly_interval != '0') {
69 Rsnapshot::Cron_file <| title == 'monthly' |> {
70 $rsnapshot_conf +> $conffile,
71 }
72 }
73 }
74 }

  ViewVC Help
Powered by ViewVC 1.1.30