comparison modules/mysql/manifests/server/backup.pp @ 443:c6c9a2cfcfbd

Update MySQL module Fixes a problem with MariaDB and blank certificate paths
author IBBoard <dev@ibboard.co.uk>
date Mon, 08 May 2023 11:48:41 +0100
parents 668df4711671
children
comparison
equal deleted inserted replaced
442:2879e2d4148e 443:c6c9a2cfcfbd
1 # @summary 1 # @summary
2 # Create and manage a MySQL backup. 2 # Create and manage a MySQL backup.
3 # 3 #
4 # @example Create a basic MySQL backup: 4 # @example Create a basic MySQL backup:
5 # class { 'mysql::server': 5 # class { 'mysql::server':
6 # root_password => 'password' 6 # root_password => 'password'
7 # } 7 # }
8 # class { 'mysql::server::backup': 8 # class { 'mysql::server::backup':
9 # backupuser => 'myuser', 9 # backupuser => 'myuser',
10 # backuppassword => 'mypassword', 10 # backuppassword => 'mypassword',
11 # backupdir => '/tmp/backups', 11 # backupdir => '/tmp/backups',
12 # }
13 #
14 # @example Create a basic MySQL backup using mariabackup:
15 # class { 'mysql::server':
16 # root_password => 'password'
12 # } 17 # }
13 # class { 'mysql::server::backup': 18 # class { 'mysql::server::backup':
14 # backupmethod => 'mariabackup', 19 # backupmethod => 'mariabackup',
15 # provider => 'xtrabackup', 20 # backupmethod_package => 'mariadb-backup'
16 # backupdir => '/tmp/backups', 21 # provider => 'xtrabackup',
22 # backupdir => '/tmp/backups',
17 # } 23 # }
18 # 24 #
19 # @param backupuser 25 # @param backupuser
20 # MySQL user to create with backup administrator privileges. 26 # MySQL user to create with backup administrator privileges.
21 # @param backuppassword 27 # @param backuppassword
37 # @param backuprotate 43 # @param backuprotate
38 # Backup rotation interval in 24 hour periods. 44 # Backup rotation interval in 24 hour periods.
39 # @param ignore_events 45 # @param ignore_events
40 # Ignore the mysql.event table. 46 # Ignore the mysql.event table.
41 # @param delete_before_dump 47 # @param delete_before_dump
42 # Whether to delete old .sql files before backing up. Setting to true deletes old files before backing up, while setting to false deletes them after backup. 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.
43 # @param backupdatabases 50 # @param backupdatabases
44 # Databases to backup (required if using xtrabackup provider). By default `[]` will back up all databases. 51 # Databases to backup (required if using xtrabackup provider). By default `[]` will back up all databases.
45 # @param file_per_database 52 # @param file_per_database
46 # Use file per database mode creating one file per database backup. 53 # Use file per database mode creating one file per database backup.
47 # @param include_routines 54 # @param include_routines
54 # @param time 61 # @param time
55 # 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. 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.
56 # @param prescript 63 # @param prescript
57 # A script that is executed before the backup begins. 64 # A script that is executed before the backup begins.
58 # @param postscript 65 # @param postscript
59 # A script that is executed when the backup is finished. This could be used to sync the backup to a central store. This script can be either a single line that is directly executed or a number of lines supplied as an array. It could also be one or more externally managed (executable) files. 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.
60 # @param execpath 69 # @param execpath
61 # Allows you to set a custom PATH should your MySQL installation be non-standard places. Defaults to `/usr/bin:/usr/sbin:/bin:/sbin`. 70 # Allows you to set a custom PATH should your MySQL installation be non-standard places. Defaults to `/usr/bin:/usr/sbin:/bin:/sbin`.
62 # @param provider 71 # @param provider
63 # Sets the server backup implementation. Valid values are: 72 # Sets the server backup implementation. Valid values are: xtrabackup, mysqldump, mysqlbackup
64 # @param maxallowedpacket 73 # @param maxallowedpacket
65 # Defines the maximum SQL statement size for the backup dump script. The default value is 1MB, as this is the default MySQL Server value. 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.
66 # @param optional_args 75 # @param optional_args
67 # Specifies an array of optional arguments which should be passed through to the backup tool. (Supported by the xtrabackup and mysqldump providers.) 76 # Specifies an array of optional arguments which should be passed through to the backup tool.
77 # (Supported by the xtrabackup and mysqldump providers.)
68 # @param install_cron 78 # @param install_cron
69 # Manage installation of cron package 79 # Manage installation of cron package
70 # @param compression_command 80 # @param compression_command
71 # Configure the command used to compress the backup (when using the mysqldump provider). Make sure the command exists 81 # Configure the command used to compress the backup (when using the mysqldump provider). Make sure the command exists
72 # on the target system. Packages for it are NOT automatically installed. 82 # on the target system. Packages for it are NOT automatically installed.
73 # @param compression_extension 83 # @param compression_extension
74 # Configure the file extension for the compressed backup (when using the mysqldump provider) 84 # Configure the file extension for the compressed backup (when using the mysqldump provider)
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' ]
75 class mysql::server::backup ( 89 class mysql::server::backup (
76 $backupuser = undef, 90 Optional[String[1]] $backupuser = undef,
77 Optional[Variant[String, Sensitive[String]]] $backuppassword = undef, 91 Optional[Variant[String, Sensitive[String]]] $backuppassword = undef,
78 $backupdir = undef, 92 Optional[String[1]] $backupdir = undef,
79 $backupdirmode = '0700', 93 String[1] $backupdirmode = '0700',
80 $backupdirowner = 'root', 94 String[1] $backupdirowner = 'root',
81 $backupdirgroup = $mysql::params::root_group, 95 String[1] $backupdirgroup = $mysql::params::root_group,
82 $backupcompress = true, 96 Boolean $backupcompress = true,
83 $backuprotate = 30, 97 Variant[String[1], Integer] $backuprotate = 30,
84 $backupmethod = undef, 98 Optional[String[1]] $backupmethod = undef,
85 $backup_success_file_path = '/tmp/mysqlbackup_success', 99 String[1] $backup_success_file_path = '/tmp/mysqlbackup_success',
86 $ignore_events = true, 100 Boolean $ignore_events = true,
87 $delete_before_dump = false, 101 Boolean $delete_before_dump = false,
88 $backupdatabases = [], 102 Array[String[1]] $backupdatabases = [],
89 $file_per_database = false, 103 Boolean $file_per_database = false,
90 $include_routines = false, 104 Boolean $include_routines = false,
91 $include_triggers = false, 105 Boolean $include_triggers = false,
92 $ensure = 'present', 106 Variant[Enum['present','absent'], Pattern[/(\d+)[\.](\d+)[\.](\d+)/]] $ensure = 'present',
93 $time = ['23', '5'], 107 Variant[Array[String[1]], Array[Integer]] $time = ['23', '5'],
94 $prescript = false, 108 Variant[Boolean, String[1], Array[String[1]]] $prescript = false,
95 $postscript = false, 109 Variant[Boolean, String[1], Array[String[1]]] $postscript = false,
96 $execpath = '/usr/bin:/usr/sbin:/bin:/sbin', 110 String[1] $execpath = '/usr/bin:/usr/sbin:/bin:/sbin',
97 $provider = 'mysqldump', 111 Enum['xtrabackup', 'mysqldump', 'mysqlbackup'] $provider = 'mysqldump',
98 $maxallowedpacket = '1M', 112 String[1] $maxallowedpacket = '1M',
99 $optional_args = [], 113 Array[String[1]] $optional_args = [],
100 $incremental_backups = true, 114 Boolean $incremental_backups = true,
101 $install_cron = true, 115 Boolean $install_cron = true,
102 $compression_command = undef, 116 Optional[String[1]] $compression_command = undef,
103 $compression_extension = undef 117 Optional[String[1]] $compression_extension = undef,
118 String[1] $backupmethod_package = $mysql::params::xtrabackup_package_name,
119 Array[String] $excludedatabases = [],
104 ) inherits mysql::params { 120 ) inherits mysql::params {
105 if $prescript and $provider =~ /(mysqldump|mysqlbackup)/ { 121 if $prescript and $provider =~ /(mysqldump|mysqlbackup)/ {
106 warning("The 'prescript' option is not currently implemented for the ${provider} backup provider.") 122 warning("The 'prescript' option is not currently implemented for the ${provider} backup provider.")
107 } 123 }
108 124
133 'optional_args' => $optional_args, 149 'optional_args' => $optional_args,
134 'incremental_backups' => $incremental_backups, 150 'incremental_backups' => $incremental_backups,
135 'install_cron' => $install_cron, 151 'install_cron' => $install_cron,
136 'compression_command' => $compression_command, 152 'compression_command' => $compression_command,
137 'compression_extension' => $compression_extension, 153 'compression_extension' => $compression_extension,
154 'backupmethod_package' => $backupmethod_package,
155 'excludedatabases' => $excludedatabases,
138 } 156 }
139 }) 157 })
140 } 158 }