-
Notifications
You must be signed in to change notification settings - Fork 36
/
pug.pug
78 lines (68 loc) · 1.95 KB
/
pug.pug
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: automysqlbackup
#
# Puppet module to install AutoMySQLBackup for periodic MySQL backups.
#
# class { 'automysqlbackup':
# backup_dir => '/mnt/backups',
# }
#
class automysqlbackup (
$bin_dir = $automysqlbackup::params::bin_dir,
$etc_dir = $automysqlbackup::params::etc_dir,
$backup_dir = $automysqlbackup::params::backup_dir,
$install_multicore = undef,
$config = {},
$config_defaults = {},
) inherits automysqlbackup::params {
# Ensure valid paths are assigned
validate_absolute_path($bin_dir)
validate_absolute_path($etc_dir)
validate_absolute_path($backup_dir)
# Create a subdirectory in /etc for config files
file { $etc_dir:
ensure => directory,
owner => 'root',
group => 'root',
mode => '0750',
}
# Create an example backup file, useful for reference
file { "${etc_dir}/automysqlbackup.conf.example":
ensure => file,
owner => 'root',
group => 'root',
mode => '0660',
source => 'puppet:///modules/automysqlbackup/automysqlbackup.conf',
}
# Add files from the developer
file { "${etc_dir}/AMB_README":
ensure => file,
source => 'puppet:///modules/automysqlbackup/AMB_README',
}
file { "${etc_dir}/AMB_LICENSE":
ensure => file,
source => 'puppet:///modules/automysqlbackup/AMB_LICENSE',
}
# Install the actual binary file
file { "${bin_dir}/automysqlbackup":
ensure => file,
owner => 'root',
group => 'root',
mode => '0755',
source => 'puppet:///modules/automysqlbackup/automysqlbackup',
}
# Create the base backup directory
file { $backup_dir:
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
}
# If you'd like to keep your config in hiera and pass it to this class
if !empty($config) {
create_resources('automysqlbackup::backup', $config, $config_defaults)
}
# If using RedHat family, must have the RPMforge repo's enabled
if $install_multicore {
package { ['pigz', 'pbzip2']: ensure => installed }
}
}