Mercurial > repos > other > Puppet
annotate modules/mysql/manifests/server/backup.pp @ 454:d0e7979c7e8c
Update PHP configs for Ubuntu
Mostly fixing some INI naming so that it is consistent
between packages and what we write (so we don't end up with
mixed/duplicate content)
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 13 Aug 2023 15:26:37 +0100 |
parents | c6c9a2cfcfbd |
children |
rev | line source |
---|---|
244 | 1 # @summary |
2 # Create and manage a MySQL backup. | |
3 # | |
4 # @example Create a basic MySQL backup: | |
5 # class { 'mysql::server': | |
443 | 6 # root_password => 'password' |
244 | 7 # } |
8 # class { 'mysql::server::backup': | |
443 | 9 # backupuser => 'myuser', |
10 # backuppassword => 'mypassword', | |
11 # backupdir => '/tmp/backups', | |
12 # } | |
13 # | |
14 # @example Create a basic MySQL backup using mariabackup: | |
15 # class { 'mysql::server': | |
16 # root_password => 'password' | |
244 | 17 # } |
18 # class { 'mysql::server::backup': | |
443 | 19 # backupmethod => 'mariabackup', |
20 # backupmethod_package => 'mariadb-backup' | |
21 # provider => 'xtrabackup', | |
22 # backupdir => '/tmp/backups', | |
244 | 23 # } |
24 # | |
25 # @param backupuser | |
389 | 26 # MySQL user to create with backup administrator privileges. |
244 | 27 # @param backuppassword |
389 | 28 # Password to create for `backupuser`. |
244 | 29 # @param backupdir |
30 # Directory to store backup. | |
31 # @param backupdirmode | |
32 # Permissions applied to the backup directory. This parameter is passed directly to the file resource. | |
33 # @param backupdirowner | |
34 # Owner for the backup directory. This parameter is passed directly to the file resource. | |
35 # @param backupdirgroup | |
36 # Group owner for the backup directory. This parameter is passed directly to the file resource. | |
37 # @param backupcompress | |
389 | 38 # Whether or not to compress the backup (when using the mysqldump or xtrabackup provider) |
244 | 39 # @param backupmethod |
40 # The execution binary for backing up. ex. mysqldump, xtrabackup, mariabackup | |
41 # @param backup_success_file_path | |
42 # Specify a path where upon successfull backup a file should be created for checking purposes. | |
43 # @param backuprotate | |
44 # Backup rotation interval in 24 hour periods. | |
45 # @param ignore_events | |
46 # Ignore the mysql.event table. | |
47 # @param delete_before_dump | |
443 | 48 # Whether to delete old .sql files before backing up. |
49 # Setting to true deletes old files before backing up, while setting to false deletes them after backup. | |
244 | 50 # @param backupdatabases |
51 # Databases to backup (required if using xtrabackup provider). By default `[]` will back up all databases. | |
52 # @param file_per_database | |
53 # Use file per database mode creating one file per database backup. | |
54 # @param include_routines | |
55 # Dump stored routines (procedures and functions) from dumped databases when doing a `file_per_database` backup. | |
56 # @param include_triggers | |
57 # Dump triggers for each dumped table when doing a `file_per_database` backup. | |
389 | 58 # @param incremental_backups |
59 # A flag to activate/deactivate incremental backups. Currently only supported by the xtrabackup provider. | |
244 | 60 # @param ensure |
61 # @param time | |
62 # An array of two elements to set the backup time. Allows ['23', '5'] (i.e., 23:05) or ['3', '45'] (i.e., 03:45) for HH:MM times. | |
63 # @param prescript | |
64 # A script that is executed before the backup begins. | |
65 # @param postscript | |
443 | 66 # A script that is executed when the backup is finished. This could be used to sync the backup to a central store. |
67 # This script can be either a single line that is directly executed or a number of lines supplied as an array. | |
68 # It could also be one or more externally managed (executable) files. | |
244 | 69 # @param execpath |
70 # Allows you to set a custom PATH should your MySQL installation be non-standard places. Defaults to `/usr/bin:/usr/sbin:/bin:/sbin`. | |
71 # @param provider | |
443 | 72 # Sets the server backup implementation. Valid values are: xtrabackup, mysqldump, mysqlbackup |
244 | 73 # @param maxallowedpacket |
74 # Defines the maximum SQL statement size for the backup dump script. The default value is 1MB, as this is the default MySQL Server value. | |
75 # @param optional_args | |
443 | 76 # Specifies an array of optional arguments which should be passed through to the backup tool. |
77 # (Supported by the xtrabackup and mysqldump providers.) | |
389 | 78 # @param install_cron |
79 # Manage installation of cron package | |
80 # @param compression_command | |
81 # Configure the command used to compress the backup (when using the mysqldump provider). Make sure the command exists | |
82 # on the target system. Packages for it are NOT automatically installed. | |
83 # @param compression_extension | |
84 # Configure the file extension for the compressed backup (when using the mysqldump provider) | |
443 | 85 # @param backupmethod_package |
86 # The package which provides the binary specified by the backupmethod parameter. | |
87 # @param excludedatabases | |
88 # Give a list of excluded databases when using file_per_database, e.g.: [ 'information_schema', 'performance_schema' ] | |
0
956e484adc12
Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
89 class mysql::server::backup ( |
443 | 90 Optional[String[1]] $backupuser = undef, |
91 Optional[Variant[String, Sensitive[String]]] $backuppassword = undef, | |
92 Optional[String[1]] $backupdir = undef, | |
93 String[1] $backupdirmode = '0700', | |
94 String[1] $backupdirowner = 'root', | |
95 String[1] $backupdirgroup = $mysql::params::root_group, | |
96 Boolean $backupcompress = true, | |
97 Variant[String[1], Integer] $backuprotate = 30, | |
98 Optional[String[1]] $backupmethod = undef, | |
99 String[1] $backup_success_file_path = '/tmp/mysqlbackup_success', | |
100 Boolean $ignore_events = true, | |
101 Boolean $delete_before_dump = false, | |
102 Array[String[1]] $backupdatabases = [], | |
103 Boolean $file_per_database = false, | |
104 Boolean $include_routines = false, | |
105 Boolean $include_triggers = false, | |
106 Variant[Enum['present','absent'], Pattern[/(\d+)[\.](\d+)[\.](\d+)/]] $ensure = 'present', | |
107 Variant[Array[String[1]], Array[Integer]] $time = ['23', '5'], | |
108 Variant[Boolean, String[1], Array[String[1]]] $prescript = false, | |
109 Variant[Boolean, String[1], Array[String[1]]] $postscript = false, | |
110 String[1] $execpath = '/usr/bin:/usr/sbin:/bin:/sbin', | |
111 Enum['xtrabackup', 'mysqldump', 'mysqlbackup'] $provider = 'mysqldump', | |
112 String[1] $maxallowedpacket = '1M', | |
113 Array[String[1]] $optional_args = [], | |
114 Boolean $incremental_backups = true, | |
115 Boolean $install_cron = true, | |
116 Optional[String[1]] $compression_command = undef, | |
117 Optional[String[1]] $compression_extension = undef, | |
118 String[1] $backupmethod_package = $mysql::params::xtrabackup_package_name, | |
119 Array[String] $excludedatabases = [], | |
244 | 120 ) inherits mysql::params { |
121 if $prescript and $provider =~ /(mysqldump|mysqlbackup)/ { | |
389 | 122 warning("The 'prescript' option is not currently implemented for the ${provider} backup provider.") |
244 | 123 } |
0
956e484adc12
Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
124 |
26
58d1818c2ded
Update MySQL module (which adds "staging" module)
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
125 create_resources('class', { |
389 | 126 "mysql::backup::${provider}" => { |
127 'backupuser' => $backupuser, | |
128 'backuppassword' => $backuppassword, | |
129 'backupdir' => $backupdir, | |
130 'backupdirmode' => $backupdirmode, | |
131 'backupdirowner' => $backupdirowner, | |
132 'backupdirgroup' => $backupdirgroup, | |
133 'backupcompress' => $backupcompress, | |
134 'backuprotate' => $backuprotate, | |
135 'backupmethod' => $backupmethod, | |
136 'backup_success_file_path' => $backup_success_file_path, | |
137 'ignore_events' => $ignore_events, | |
138 'delete_before_dump' => $delete_before_dump, | |
139 'backupdatabases' => $backupdatabases, | |
140 'file_per_database' => $file_per_database, | |
141 'include_routines' => $include_routines, | |
142 'include_triggers' => $include_triggers, | |
143 'ensure' => $ensure, | |
144 'time' => $time, | |
145 'prescript' => $prescript, | |
146 'postscript' => $postscript, | |
147 'execpath' => $execpath, | |
148 'maxallowedpacket' => $maxallowedpacket, | |
149 'optional_args' => $optional_args, | |
150 'incremental_backups' => $incremental_backups, | |
151 'install_cron' => $install_cron, | |
152 'compression_command' => $compression_command, | |
153 'compression_extension' => $compression_extension, | |
443 | 154 'backupmethod_package' => $backupmethod_package, |
155 'excludedatabases' => $excludedatabases, | |
389 | 156 } |
26
58d1818c2ded
Update MySQL module (which adds "staging" module)
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
157 }) |
0
956e484adc12
Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
158 } |