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
79
80
81
82
83
84
85
86
87
88
89
|
# File 'manifests/init.pp', line 1
class alkivi_backup (
$hostname,
$include_dir,
$exclude_dir,
$encryption = 'yes',
$root = '/',
$backup_method = 'ssh',
$ssh_user = 'alkivi-backup',
$ssh_host = 'admin.alkivi.fr',
$ssh_port = '2202',
$ssh_dir = '',
$file_dir = '',
$static_options = '--full-if-older-than 14D --s3-use-new-style',
$clean_up_type = 'remove-all-but-n-full',
$clean_up_variable = '2',
$logdir = '/home/alkivi/logs/backup/',
$log_file = 'backup-`date +%Y-%m-%d`.txt',
$log_owner = 'alkivi:alkivi',
$verbosity = '-v3',
$email = 'monitoring@alkivi.fr',
$email_from = '',
$email_subject = 'Backup',
$mail_command = 'sendmail',
) {
validate_string($encryption)
validate_string($root)
validate_array($include_dir)
validate_array($exclude_dir)
validate_string($static_options)
if($backup_method == 'ssh')
{
validate_string($ssh_user)
validate_string($ssh_host)
validate_string($ssh_port)
#validate_string($ssh_dir)
if($ssh_dir != '')
{
$dest = "ssh://${ssh_user}@${ssh_host}:${ssh_port}/${ssh_dir}"
}
else
{
$dest = "ssh://${ssh_user}@${ssh_host}:${ssh_port}"
}
}
elsif($backup_method == 'file')
{
$dest = "file://${file_dir}"
}
else
{
fail("Backup method ${backup_method} is not currently supported")
}
if($encryption == 'yes')
{
$passphrase = generate('/usr/bin/sudo', '/root/alkivi-scripts/genpwd', '--save', $hostname, '--savedir', '/root/.passwd/alkivi-backup', '--print', '--length', '45')
}
elsif($encryption == 'no')
{
}
else
{
fail("Wrong parameter encryption ${encryption}")
}
# declare all parameterized classes
class { 'alkivi_backup::params': }
class { 'alkivi_backup::install': }
class { 'alkivi_backup::config': }
class { 'alkivi_backup::service': }
# declare relationships
Class['alkivi_base'] ->
Class['alkivi_backup::params'] ->
Class['alkivi_backup::install'] ->
Class['alkivi_backup::config'] ->
Class['alkivi_backup::service']
}
|