-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.pp
46 lines (43 loc) · 1.18 KB
/
init.pp
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
class solr {
# = Define: solr::backup
#
# Set up solr backups
#
# == Parameters:
#
# $solr_url:: A URL to a solr server ( Example: http://solr0:8080/solr )
#
# $user:: The user who will own the backups
#
# $group:: The group who will own the backups
#
# $backup_dir:: A directory to store the backups
#
# == Actions:
# Create the backup dir and a cron job.
#
# == Sample Usage:
#
# solr::backup { 'backup-solr0':
# solr_url => "http://solr0:8080/solr",
# backup_dir => '/usr/local/solr/backups',
# user => solr,
# group => solr,
# }
#
define backup($solr_url, $user, $group, $backup_dir) {
file { $backup_dir:
ensure => directory,
owner => $user,
group => $group,
mode => 0750,
}
cron { "solr-backup-${solr_url}-${backup_dir}":
user => $user,
command => "curl '${solr_url}/replication?command=backup&location=${backup_dir}'",
minute => '0',
hour => '1',
require => File[$backup_dir],
}
}
}