Mercurial > repos > other > Puppet
changeset 443:c6c9a2cfcfbd
Update MySQL module
Fixes a problem with MariaDB and blank certificate paths
line wrap: on
line diff
--- a/modules/mysql/.github/workflows/auto_release.yml Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/.github/workflows/auto_release.yml Mon May 08 11:48:41 2023 +0100 @@ -14,6 +14,7 @@ runs-on: ubuntu-20.04 steps: + - name: "Honeycomb: Start recording" uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1 with: @@ -25,7 +26,6 @@ run: | echo STEP_ID="auto-release" >> $GITHUB_ENV echo STEP_START=$(date +%s) >> $GITHUB_ENV - - name: "Checkout Source" if: ${{ github.repository_owner == 'puppetlabs' }} uses: actions/checkout@v2 @@ -83,7 +83,7 @@ run: | echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" - + - name: "Honeycomb: Record finish step" if: ${{ always() }} run: |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/mysql/.github/workflows/labeller.yml Mon May 08 11:48:41 2023 +0100 @@ -0,0 +1,22 @@ +name: community-labeller + +on: + issues: + types: + - opened + pull_request_target: + types: + - opened + +jobs: + label: + runs-on: ubuntu-latest + steps: + + - uses: puppetlabs/community-labeller@v0 + name: Label issues or pull requests + with: + label_name: community + label_color: '5319e7' + org_membership: puppetlabs + token: ${{ secrets.IAC_COMMUNITY_LABELER }}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/mysql/.github/workflows/mend.yml Mon May 08 11:48:41 2023 +0100 @@ -0,0 +1,15 @@ +name: "mend" + +on: + pull_request: + branches: + - "main" + schedule: + - cron: "0 0 * * *" + workflow_dispatch: + +jobs: + + mend: + uses: "puppetlabs/cat-github-actions/.github/workflows/mend_ruby.yml@main" + secrets: "inherit"
--- a/modules/mysql/.github/workflows/nightly.yml Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/.github/workflows/nightly.yml Mon May 08 11:48:41 2023 +0100 @@ -4,18 +4,21 @@ schedule: - cron: '0 0 * * *' + env: HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6 HONEYCOMB_DATASET: litmus tests jobs: setup_matrix: + if: ${{ github.repository_owner == 'puppetlabs' }} name: "Setup Test Matrix" runs-on: ubuntu-20.04 outputs: matrix: ${{ steps.get-matrix.outputs.matrix }} steps: + - name: "Honeycomb: Start recording" uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1 with: @@ -27,7 +30,6 @@ run: | echo STEP_ID=setup-environment >> $GITHUB_ENV echo STEP_START=$(date +%s) >> $GITHUB_ENV - - name: Checkout Source uses: actions/checkout@v2 if: ${{ github.repository_owner == 'puppetlabs' }} @@ -52,13 +54,12 @@ buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment' echo STEP_ID=Setup-Acceptance-Test-Matrix >> $GITHUB_ENV echo STEP_START=$(date +%s) >> $GITHUB_ENV - - name: Setup Acceptance Test Matrix id: get-matrix if: ${{ github.repository_owner == 'puppetlabs' }} run: | if [ '${{ github.repository_owner }}' == 'puppetlabs' ]; then - buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata_v2 + buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata_v2 else echo "::set-output name=matrix::{}" fi @@ -67,7 +68,6 @@ if: ${{ always() }} run: | buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Test Matrix' - Acceptance: name: "${{matrix.platforms.label}}, ${{matrix.collection}}" needs: @@ -123,6 +123,12 @@ echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-2 >> $GITHUB_ENV echo STEP_START=$(date +%s) >> $GITHUB_ENV + - name: "Disable mysqld apparmor profile" + if: matrix.platforms.provider == 'provision::docker' + run: | + sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/ + sudo apparmor_parser -R /etc/apparmor.d/disable/usr.sbin.mysqld + - name: Provision test environment run: | buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:provision ${{ matrix.platforms.image }}' -- bundle exec rake 'litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }}]' @@ -187,7 +193,7 @@ buildevents step $TRACE_ID $STEP_ID $STEP_START 'Remove test environment' slack-workflow-status: - if: always() + if: ${{ github.repository_owner == 'puppetlabs' }} name: Post Workflow Status To Slack needs: - Acceptance @@ -200,5 +206,5 @@ repo_token: ${{ secrets.GITHUB_TOKEN }} slack_webhook_url: ${{ secrets.SLACK_WEBHOOK }} # Optional Input - channel: '#team-ia-bots' + channel: '#team-cat-bots' name: 'GABot'
--- a/modules/mysql/.github/workflows/pr_test.yml Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/.github/workflows/pr_test.yml Mon May 08 11:48:41 2023 +0100 @@ -2,7 +2,9 @@ on: [pull_request] + env: + HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6 HONEYCOMB_DATASET: litmus tests @@ -14,6 +16,7 @@ matrix: ${{ steps.get-matrix.outputs.matrix }} steps: + - name: "Honeycomb: Start recording" uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1 with: @@ -25,7 +28,6 @@ run: | echo STEP_ID=setup-environment >> $GITHUB_ENV echo STEP_START=$(date +%s) >> $GITHUB_ENV - - name: Checkout Source uses: actions/checkout@v2 if: ${{ github.repository_owner == 'puppetlabs' }} @@ -60,7 +62,7 @@ id: get-matrix run: | if [ '${{ github.repository_owner }}' == 'puppetlabs' ]; then - buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata_v2 + buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata_v2 else echo "::set-output name=matrix::{}" fi @@ -102,7 +104,6 @@ run: | echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-1 >> $GITHUB_ENV echo STEP_START=$(date +%s) >> $GITHUB_ENV - - name: Checkout Source uses: actions/checkout@v2 @@ -125,6 +126,12 @@ echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-2 >> $GITHUB_ENV echo STEP_START=$(date +%s) >> $GITHUB_ENV + - name: "Disable mysqld apparmor profile" + if: matrix.platforms.provider == 'provision::docker' + run: | + sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/ + sudo apparmor_parser -R /etc/apparmor.d/disable/usr.sbin.mysqld + - name: Provision test environment run: | buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:provision ${{ matrix.platforms.image }}' -- bundle exec rake 'litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }}]' @@ -159,7 +166,6 @@ echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-3 >> $GITHUB_ENV echo STEP_START=$(date +%s) >> $GITHUB_ENV echo ::endgroup:: - - name: Run acceptance tests run: | buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:acceptance:parallel' -- bundle exec rake 'litmus:acceptance:parallel' @@ -170,7 +176,6 @@ buildevents step $TRACE_ID $STEP_ID $STEP_START 'Run acceptance tests' echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-4 >> $GITHUB_ENV echo STEP_START=$(date +%s) >> $GITHUB_ENV - - name: Remove test environment if: ${{ always() }} continue-on-error: true
--- a/modules/mysql/.github/workflows/spec.yml Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/.github/workflows/spec.yml Mon May 08 11:48:41 2023 +0100 @@ -6,6 +6,7 @@ workflow_dispatch: pull_request: + env: HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6 HONEYCOMB_DATASET: litmus tests @@ -18,6 +19,7 @@ spec_matrix: ${{ steps.get-matrix.outputs.spec_matrix }} steps: + - name: "Honeycomb: Start recording" uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1 with: @@ -29,7 +31,6 @@ run: | echo STEP_ID=setup-environment >> $GITHUB_ENV echo STEP_START=$(date +%s) >> $GITHUB_ENV - - name: Checkout Source uses: actions/checkout@v2 if: ${{ github.repository_owner == 'puppetlabs' }} @@ -47,14 +48,12 @@ echo ::group::bundler environment buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env echo ::endgroup:: - - name: "Honeycomb: Record Setup Environment time" if: ${{ github.repository_owner == 'puppetlabs' }} run: | buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment' echo STEP_ID=Setup-Acceptance-Test-Matrix >> $GITHUB_ENV echo STEP_START=$(date +%s) >> $GITHUB_ENV - - name: Run Static & Syntax Tests if: ${{ github.repository_owner == 'puppetlabs' }} run: | @@ -68,12 +67,10 @@ else echo "::set-output name=spec_matrix::{}" fi - - name: "Honeycomb: Record Setup Test Matrix time" if: ${{ always() }} run: | buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Test Matrix' - Spec: name: "Spec Tests (Puppet: ${{matrix.puppet_version}}, Ruby Ver: ${{matrix.ruby_version}})" needs: @@ -96,7 +93,6 @@ - run: | echo 'puppet_version=${{ env.SANITIZED_PUPPET_VERSION }}' >> $BUILDEVENT_FILE - - name: "Honeycomb: Start first step" run: | echo "STEP_ID=${{ env.SANITIZED_PUPPET_VERSION }}-spec" >> $GITHUB_ENV @@ -109,7 +105,6 @@ dataset: ${{ env.HONEYCOMB_DATASET }} job-status: ${{ job.status }} matrix-key: ${{ env.SANITIZED_PUPPET_VERSION }} - - name: Checkout Source uses: actions/checkout@v2 @@ -125,6 +120,7 @@ buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env echo ::endgroup:: + - name: Run parallel_spec tests run: | buildevents cmd $TRACE_ID $STEP_ID 'rake parallel_spec Puppet ${{ matrix.puppet_version }}, Ruby ${{ matrix.ruby_version }}' -- bundle exec rake parallel_spec
--- a/modules/mysql/CHANGELOG.md Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/CHANGELOG.md Mon May 08 11:48:41 2023 +0100 @@ -2,6 +2,95 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). + +## [v13.2.0](https://github.com/puppetlabs/puppetlabs-mysql/tree/v13.2.0) - 2023-02-24 + +[Full Changelog](https://github.com/puppetlabs/puppetlabs-mysql/compare/v13.1.0...v13.2.0) + +### Added + +- (CONT-359) Syntax update [#1532](https://github.com/puppetlabs/puppetlabs-mysql/pull/1532) ([LukasAud](https://github.com/LukasAud)) + +### Fixed + +- xtrabackup.sh only touch when backup_success_file_path is set [#1522](https://github.com/puppetlabs/puppetlabs-mysql/pull/1522) ([JvGinkel](https://github.com/JvGinkel)) + +## [v13.1.0](https://github.com/puppetlabs/puppetlabs-mysql/tree/v13.1.0) (2022-12-20) + +[Full Changelog](https://github.com/puppetlabs/puppetlabs-mysql/compare/v13.0.1...v13.1.0) + +### Added + +- mysql::db sql parameter support filenames with multiple dots [\#1505](https://github.com/puppetlabs/puppetlabs-mysql/pull/1505) ([skn-bvdh](https://github.com/skn-bvdh)) + +### Fixed + +- \(GH-1518\) Declare minimum Puppet version 6.24.0 [\#1519](https://github.com/puppetlabs/puppetlabs-mysql/pull/1519) ([pmcmaw](https://github.com/pmcmaw)) +- \(GH-1516\) Update sql example to use array [\#1517](https://github.com/puppetlabs/puppetlabs-mysql/pull/1517) ([pmcmaw](https://github.com/pmcmaw)) +- do not emit other ssl directives when ssl = false [\#1513](https://github.com/puppetlabs/puppetlabs-mysql/pull/1513) ([kjetilho](https://github.com/kjetilho)) +- \(GH-1491\) Fix for Ubuntu 22.04 [\#1508](https://github.com/puppetlabs/puppetlabs-mysql/pull/1508) ([david22swan](https://github.com/david22swan)) + +## [v13.0.1](https://github.com/puppetlabs/puppetlabs-mysql/tree/v13.0.1) (2022-10-24) + +[Full Changelog](https://github.com/puppetlabs/puppetlabs-mysql/compare/v13.0.0...v13.0.1) + +### Fixed + +- \(CONT-173\) - Updating deprecated facter instances [\#1501](https://github.com/puppetlabs/puppetlabs-mysql/pull/1501) ([jordanbreen28](https://github.com/jordanbreen28)) +- pdksync - \(CONT-189\) Remove support for RedHat6 / OracleLinux6 / Scientific6 [\#1498](https://github.com/puppetlabs/puppetlabs-mysql/pull/1498) ([david22swan](https://github.com/david22swan)) +- pdksync - \(CONT-130\) - Dropping Support for Debian 9 [\#1495](https://github.com/puppetlabs/puppetlabs-mysql/pull/1495) ([jordanbreen28](https://github.com/jordanbreen28)) +- MySQL 8.0: Grant required privileges to xtrabackup user [\#1478](https://github.com/puppetlabs/puppetlabs-mysql/pull/1478) ([jan-win1993](https://github.com/jan-win1993)) + +## [v13.0.0](https://github.com/puppetlabs/puppetlabs-mysql/tree/v13.0.0) (2022-08-25) + +[Full Changelog](https://github.com/puppetlabs/puppetlabs-mysql/compare/v12.0.3...v13.0.0) + +### Changed + +- Harden db defined type [\#1484](https://github.com/puppetlabs/puppetlabs-mysql/pull/1484) ([chelnak](https://github.com/chelnak)) + +### Added + +- pdksync - \(GH-cat-11\) Certify Support for Ubuntu 22.04 [\#1483](https://github.com/puppetlabs/puppetlabs-mysql/pull/1483) ([david22swan](https://github.com/david22swan)) +- \[Compatibility\] Add Raspbian OS to provider configuration [\#1481](https://github.com/puppetlabs/puppetlabs-mysql/pull/1481) ([jordi-upc](https://github.com/jordi-upc)) +- Allow excludedatabases when using file\_per\_database [\#1480](https://github.com/puppetlabs/puppetlabs-mysql/pull/1480) ([HT43-bqxFqB](https://github.com/HT43-bqxFqB)) +- pdksync - \(GH-cat-12\) Add Support for Redhat 9 [\#1477](https://github.com/puppetlabs/puppetlabs-mysql/pull/1477) ([david22swan](https://github.com/david22swan)) + +### Fixed + +- Harden config class [\#1487](https://github.com/puppetlabs/puppetlabs-mysql/pull/1487) ([chelnak](https://github.com/chelnak)) +- Harden service class [\#1486](https://github.com/puppetlabs/puppetlabs-mysql/pull/1486) ([chelnak](https://github.com/chelnak)) +- Harden root password class [\#1485](https://github.com/puppetlabs/puppetlabs-mysql/pull/1485) ([chelnak](https://github.com/chelnak)) +- Use MariaDB for Ubuntu 20.04 [\#1449](https://github.com/puppetlabs/puppetlabs-mysql/pull/1449) ([treydock](https://github.com/treydock)) +- Add support for mariabackup [\#1447](https://github.com/puppetlabs/puppetlabs-mysql/pull/1447) ([rsynnest](https://github.com/rsynnest)) + +## [v12.0.3](https://github.com/puppetlabs/puppetlabs-mysql/tree/v12.0.3) (2022-05-25) + +[Full Changelog](https://github.com/puppetlabs/puppetlabs-mysql/compare/v12.0.2...v12.0.3) + +### Fixed + +- \(IAC-1595\) MySQL maintenance [\#1472](https://github.com/puppetlabs/puppetlabs-mysql/pull/1472) ([LukasAud](https://github.com/LukasAud)) +- Solve issue with repeated restarts if ssl-disable is true [\#1425](https://github.com/puppetlabs/puppetlabs-mysql/pull/1425) ([markasammut](https://github.com/markasammut)) + +## [v12.0.2](https://github.com/puppetlabs/puppetlabs-mysql/tree/v12.0.2) (2022-04-19) + +[Full Changelog](https://github.com/puppetlabs/puppetlabs-mysql/compare/v12.0.1...v12.0.2) + +### Added + +- pdksync - \(IAC-1753\) - Add Support for AlmaLinux 8 [\#1444](https://github.com/puppetlabs/puppetlabs-mysql/pull/1444) ([david22swan](https://github.com/david22swan)) +- pdksync - \(IAC-1751\) - Add Support for Rocky 8 [\#1442](https://github.com/puppetlabs/puppetlabs-mysql/pull/1442) ([david22swan](https://github.com/david22swan)) + +### Fixed + +- \(Bugfix\) Grant privileges idempotency Fix [\#1466](https://github.com/puppetlabs/puppetlabs-mysql/pull/1466) ([LukasAud](https://github.com/LukasAud)) +- pdksync - \(GH-iac-334\) Remove Support for Ubuntu 16.04 [\#1457](https://github.com/puppetlabs/puppetlabs-mysql/pull/1457) ([david22swan](https://github.com/david22swan)) +- pdksync - \(IAC-1787\) Remove Support for CentOS 6 [\#1450](https://github.com/puppetlabs/puppetlabs-mysql/pull/1450) ([david22swan](https://github.com/david22swan)) +- add mysql\_native\_password plugin to authentication\_string vs password [\#1441](https://github.com/puppetlabs/puppetlabs-mysql/pull/1441) ([Heidistein](https://github.com/Heidistein)) +- fix Error: Transaction store file transactionstore.yaml is corrupt [\#1429](https://github.com/puppetlabs/puppetlabs-mysql/pull/1429) ([andeman](https://github.com/andeman)) +- Combine multiple grants into one while checking state [\#1428](https://github.com/puppetlabs/puppetlabs-mysql/pull/1428) ([fuyar](https://github.com/fuyar)) + ## [v12.0.1](https://github.com/puppetlabs/puppetlabs-mysql/tree/v12.0.1) (2021-08-26) [Full Changelog](https://github.com/puppetlabs/puppetlabs-mysql/compare/v12.0.0...v12.0.1)
--- a/modules/mysql/README.md Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/README.md Mon May 08 11:48:41 2023 +0100 @@ -143,7 +143,7 @@ password => 'mypass', host => 'localhost', grant => ['SELECT', 'UPDATE'], - sql => '/path/to/sqlfile.gz', + sql => ['/path/to/sqlfile.gz'], import_cat_cmd => 'zcat', import_timeout => 900, mysql_exec_path => '/opt/rh/rh-myql57/root/bin', @@ -505,6 +505,30 @@ } ``` +The next example shows how to use mariabackup (a fork of xtrabackup) as a backup provider. +Note that on most Linux/BSD distributions, this will require setting `backupmethod_package => 'mariadb-backup'` in the `mysql::server::backup` declaration in order to override the default xtrabackup package (`percona-xtrabackup`). + +```puppet +class { 'mysql::server': + package_name => 'mariadb-server', + package_ensure => '1:10.3.21+maria~xenial', + service_name => 'mysqld', + root_password => 'AVeryStrongPasswordUShouldEncrypt!', +} + +class { 'mysql::server::backup': + backupuser => 'mariabackup', + backuppassword => 'AVeryStrongPasswordUShouldEncrypt!', + provider => 'xtrabackup', + backupmethod => 'mariabackup', + backupmethod_package => 'mariadb-backup', + backupdir => '/tmp/backups', + backuprotate => 15, + execpath => '/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin', + time => ['23', '15'], +} +``` + ## Reference ### Classes
--- a/modules/mysql/REFERENCE.md Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/REFERENCE.md Mon May 08 11:48:41 2023 +0100 @@ -8,10 +8,10 @@ #### Public Classes -* [`mysql::bindings`](#mysqlbindings): Parent class for MySQL bindings. -* [`mysql::client`](#mysqlclient): Installs and configures the MySQL client. -* [`mysql::server`](#mysqlserver): Installs and configures the MySQL server. -* [`mysql::server::backup`](#mysqlserverbackup): Create and manage a MySQL backup. +* [`mysql::bindings`](#mysql--bindings): Parent class for MySQL bindings. +* [`mysql::client`](#mysql--client): Installs and configures the MySQL client. +* [`mysql::server`](#mysql--server): Installs and configures the MySQL server. +* [`mysql::server::backup`](#mysql--server--backup): Create and manage a MySQL backup. #### Private Classes @@ -38,7 +38,7 @@ ### Defined types -* [`mysql::db`](#mysqldb): Create and configure a MySQL database. +* [`mysql::db`](#mysql--db): Create and configure a MySQL database. ### Resource types @@ -56,14 +56,14 @@ ### Functions -* [`mysql::normalise_and_deepmerge`](#mysqlnormalise_and_deepmerge): Recursively merges two or more hashes together, normalises keys with differing use of dashes and underscores. -* [`mysql::password`](#mysqlpassword): Hash a string as mysql's "PASSWORD()" function would do it -* [`mysql::strip_hash`](#mysqlstrip_hash): When given a hash this function strips out all blank entries. +* [`mysql::normalise_and_deepmerge`](#mysql--normalise_and_deepmerge): Recursively merges two or more hashes together, normalises keys with differing use of dashes and underscores. +* [`mysql::password`](#mysql--password): Hash a string as mysql's "PASSWORD()" function would do it +* [`mysql::strip_hash`](#mysql--strip_hash): When given a hash this function strips out all blank entries. * [`mysql_password`](#mysql_password): DEPRECATED. Use the namespaced function [`mysql::password`](#mysqlpassword) instead. ### Data types -* [`Mysql::Options`](#mysqloptions): A hash of options structured like the override_options, but not merged with the default options. +* [`Mysql::Options`](#Mysql--Options): A hash of options structured like the override_options, but not merged with the default options. ### Tasks @@ -72,7 +72,7 @@ ## Classes -### <a name="mysqlbindings"></a>`mysql::bindings` +### <a name="mysql--bindings"></a>`mysql::bindings` Parent class for MySQL bindings. @@ -93,101 +93,101 @@ The following parameters are available in the `mysql::bindings` class: -* [`install_options`](#install_options) -* [`java_enable`](#java_enable) -* [`perl_enable`](#perl_enable) -* [`php_enable`](#php_enable) -* [`python_enable`](#python_enable) -* [`ruby_enable`](#ruby_enable) -* [`client_dev`](#client_dev) -* [`daemon_dev`](#daemon_dev) -* [`java_package_ensure`](#java_package_ensure) -* [`java_package_name`](#java_package_name) -* [`java_package_provider`](#java_package_provider) -* [`perl_package_ensure`](#perl_package_ensure) -* [`perl_package_name`](#perl_package_name) -* [`perl_package_provider`](#perl_package_provider) -* [`php_package_ensure`](#php_package_ensure) -* [`php_package_name`](#php_package_name) -* [`php_package_provider`](#php_package_provider) -* [`python_package_ensure`](#python_package_ensure) -* [`python_package_name`](#python_package_name) -* [`python_package_provider`](#python_package_provider) -* [`ruby_package_ensure`](#ruby_package_ensure) -* [`ruby_package_name`](#ruby_package_name) -* [`ruby_package_provider`](#ruby_package_provider) -* [`client_dev_package_ensure`](#client_dev_package_ensure) -* [`client_dev_package_name`](#client_dev_package_name) -* [`client_dev_package_provider`](#client_dev_package_provider) -* [`daemon_dev_package_ensure`](#daemon_dev_package_ensure) -* [`daemon_dev_package_name`](#daemon_dev_package_name) -* [`daemon_dev_package_provider`](#daemon_dev_package_provider) - -##### <a name="install_options"></a>`install_options` +* [`install_options`](#-mysql--bindings--install_options) +* [`java_enable`](#-mysql--bindings--java_enable) +* [`perl_enable`](#-mysql--bindings--perl_enable) +* [`php_enable`](#-mysql--bindings--php_enable) +* [`python_enable`](#-mysql--bindings--python_enable) +* [`ruby_enable`](#-mysql--bindings--ruby_enable) +* [`client_dev`](#-mysql--bindings--client_dev) +* [`daemon_dev`](#-mysql--bindings--daemon_dev) +* [`java_package_ensure`](#-mysql--bindings--java_package_ensure) +* [`java_package_name`](#-mysql--bindings--java_package_name) +* [`java_package_provider`](#-mysql--bindings--java_package_provider) +* [`perl_package_ensure`](#-mysql--bindings--perl_package_ensure) +* [`perl_package_name`](#-mysql--bindings--perl_package_name) +* [`perl_package_provider`](#-mysql--bindings--perl_package_provider) +* [`php_package_ensure`](#-mysql--bindings--php_package_ensure) +* [`php_package_name`](#-mysql--bindings--php_package_name) +* [`php_package_provider`](#-mysql--bindings--php_package_provider) +* [`python_package_ensure`](#-mysql--bindings--python_package_ensure) +* [`python_package_name`](#-mysql--bindings--python_package_name) +* [`python_package_provider`](#-mysql--bindings--python_package_provider) +* [`ruby_package_ensure`](#-mysql--bindings--ruby_package_ensure) +* [`ruby_package_name`](#-mysql--bindings--ruby_package_name) +* [`ruby_package_provider`](#-mysql--bindings--ruby_package_provider) +* [`client_dev_package_ensure`](#-mysql--bindings--client_dev_package_ensure) +* [`client_dev_package_name`](#-mysql--bindings--client_dev_package_name) +* [`client_dev_package_provider`](#-mysql--bindings--client_dev_package_provider) +* [`daemon_dev_package_ensure`](#-mysql--bindings--daemon_dev_package_ensure) +* [`daemon_dev_package_name`](#-mysql--bindings--daemon_dev_package_name) +* [`daemon_dev_package_provider`](#-mysql--bindings--daemon_dev_package_provider) + +##### <a name="-mysql--bindings--install_options"></a>`install_options` Data type: `Any` Passes `install_options` array to managed package resources. You must pass the [appropriate options](https://docs.puppetlabs.com/references/latest/type.html#package-attribute-install_options) for the package manager(s). -Default value: ``undef`` - -##### <a name="java_enable"></a>`java_enable` +Default value: `undef` + +##### <a name="-mysql--bindings--java_enable"></a>`java_enable` Data type: `Any` Specifies whether `::mysql::bindings::java` should be included. Valid values are `true`, `false`. -Default value: ``false`` - -##### <a name="perl_enable"></a>`perl_enable` +Default value: `false` + +##### <a name="-mysql--bindings--perl_enable"></a>`perl_enable` Data type: `Any` Specifies whether `mysql::bindings::perl` should be included. Valid values are `true`, `false`. -Default value: ``false`` - -##### <a name="php_enable"></a>`php_enable` +Default value: `false` + +##### <a name="-mysql--bindings--php_enable"></a>`php_enable` Data type: `Any` Specifies whether `mysql::bindings::php` should be included. Valid values are `true`, `false`. -Default value: ``false`` - -##### <a name="python_enable"></a>`python_enable` +Default value: `false` + +##### <a name="-mysql--bindings--python_enable"></a>`python_enable` Data type: `Any` Specifies whether `mysql::bindings::python` should be included. Valid values are `true`, `false`. -Default value: ``false`` - -##### <a name="ruby_enable"></a>`ruby_enable` +Default value: `false` + +##### <a name="-mysql--bindings--ruby_enable"></a>`ruby_enable` Data type: `Any` Specifies whether `mysql::bindings::ruby` should be included. Valid values are `true`, `false`. -Default value: ``false`` - -##### <a name="client_dev"></a>`client_dev` +Default value: `false` + +##### <a name="-mysql--bindings--client_dev"></a>`client_dev` Data type: `Any` Specifies whether `::mysql::bindings::client_dev` should be included. Valid values are `true`', `false`. -Default value: ``false`` - -##### <a name="daemon_dev"></a>`daemon_dev` +Default value: `false` + +##### <a name="-mysql--bindings--daemon_dev"></a>`daemon_dev` Data type: `Any` Specifies whether `::mysql::bindings::daemon_dev` should be included. Valid values are `true`, `false`. -Default value: ``false`` - -##### <a name="java_package_ensure"></a>`java_package_ensure` +Default value: `false` + +##### <a name="-mysql--bindings--java_package_ensure"></a>`java_package_ensure` Data type: `Any` @@ -195,7 +195,7 @@ Default value: `$mysql::params::java_package_ensure` -##### <a name="java_package_name"></a>`java_package_name` +##### <a name="-mysql--bindings--java_package_name"></a>`java_package_name` Data type: `Any` @@ -203,7 +203,7 @@ Default value: `$mysql::params::java_package_name` -##### <a name="java_package_provider"></a>`java_package_provider` +##### <a name="-mysql--bindings--java_package_provider"></a>`java_package_provider` Data type: `Any` @@ -211,7 +211,7 @@ Default value: `$mysql::params::java_package_provider` -##### <a name="perl_package_ensure"></a>`perl_package_ensure` +##### <a name="-mysql--bindings--perl_package_ensure"></a>`perl_package_ensure` Data type: `Any` @@ -219,7 +219,7 @@ Default value: `$mysql::params::perl_package_ensure` -##### <a name="perl_package_name"></a>`perl_package_name` +##### <a name="-mysql--bindings--perl_package_name"></a>`perl_package_name` Data type: `Any` @@ -227,7 +227,7 @@ Default value: `$mysql::params::perl_package_name` -##### <a name="perl_package_provider"></a>`perl_package_provider` +##### <a name="-mysql--bindings--perl_package_provider"></a>`perl_package_provider` Data type: `Any` @@ -235,7 +235,7 @@ Default value: `$mysql::params::perl_package_provider` -##### <a name="php_package_ensure"></a>`php_package_ensure` +##### <a name="-mysql--bindings--php_package_ensure"></a>`php_package_ensure` Data type: `Any` @@ -243,7 +243,7 @@ Default value: `$mysql::params::php_package_ensure` -##### <a name="php_package_name"></a>`php_package_name` +##### <a name="-mysql--bindings--php_package_name"></a>`php_package_name` Data type: `Any` @@ -251,7 +251,7 @@ Default value: `$mysql::params::php_package_name` -##### <a name="php_package_provider"></a>`php_package_provider` +##### <a name="-mysql--bindings--php_package_provider"></a>`php_package_provider` Data type: `Any` @@ -259,7 +259,7 @@ Default value: `$mysql::params::php_package_provider` -##### <a name="python_package_ensure"></a>`python_package_ensure` +##### <a name="-mysql--bindings--python_package_ensure"></a>`python_package_ensure` Data type: `Any` @@ -267,7 +267,7 @@ Default value: `$mysql::params::python_package_ensure` -##### <a name="python_package_name"></a>`python_package_name` +##### <a name="-mysql--bindings--python_package_name"></a>`python_package_name` Data type: `Any` @@ -275,7 +275,7 @@ Default value: `$mysql::params::python_package_name` -##### <a name="python_package_provider"></a>`python_package_provider` +##### <a name="-mysql--bindings--python_package_provider"></a>`python_package_provider` Data type: `Any` @@ -283,7 +283,7 @@ Default value: `$mysql::params::python_package_provider` -##### <a name="ruby_package_ensure"></a>`ruby_package_ensure` +##### <a name="-mysql--bindings--ruby_package_ensure"></a>`ruby_package_ensure` Data type: `Any` @@ -291,7 +291,7 @@ Default value: `$mysql::params::ruby_package_ensure` -##### <a name="ruby_package_name"></a>`ruby_package_name` +##### <a name="-mysql--bindings--ruby_package_name"></a>`ruby_package_name` Data type: `Any` @@ -299,7 +299,7 @@ Default value: `$mysql::params::ruby_package_name` -##### <a name="ruby_package_provider"></a>`ruby_package_provider` +##### <a name="-mysql--bindings--ruby_package_provider"></a>`ruby_package_provider` Data type: `Any` @@ -307,7 +307,7 @@ Default value: `$mysql::params::ruby_package_provider` -##### <a name="client_dev_package_ensure"></a>`client_dev_package_ensure` +##### <a name="-mysql--bindings--client_dev_package_ensure"></a>`client_dev_package_ensure` Data type: `Any` @@ -315,7 +315,7 @@ Default value: `$mysql::params::client_dev_package_ensure` -##### <a name="client_dev_package_name"></a>`client_dev_package_name` +##### <a name="-mysql--bindings--client_dev_package_name"></a>`client_dev_package_name` Data type: `Any` @@ -323,7 +323,7 @@ Default value: `$mysql::params::client_dev_package_name` -##### <a name="client_dev_package_provider"></a>`client_dev_package_provider` +##### <a name="-mysql--bindings--client_dev_package_provider"></a>`client_dev_package_provider` Data type: `Any` @@ -331,7 +331,7 @@ Default value: `$mysql::params::client_dev_package_provider` -##### <a name="daemon_dev_package_ensure"></a>`daemon_dev_package_ensure` +##### <a name="-mysql--bindings--daemon_dev_package_ensure"></a>`daemon_dev_package_ensure` Data type: `Any` @@ -339,7 +339,7 @@ Default value: `$mysql::params::daemon_dev_package_ensure` -##### <a name="daemon_dev_package_name"></a>`daemon_dev_package_name` +##### <a name="-mysql--bindings--daemon_dev_package_name"></a>`daemon_dev_package_name` Data type: `Any` @@ -347,7 +347,7 @@ Default value: `$mysql::params::daemon_dev_package_name` -##### <a name="daemon_dev_package_provider"></a>`daemon_dev_package_provider` +##### <a name="-mysql--bindings--daemon_dev_package_provider"></a>`daemon_dev_package_provider` Data type: `Any` @@ -355,7 +355,7 @@ Default value: `$mysql::params::daemon_dev_package_provider` -### <a name="mysqlclient"></a>`mysql::client` +### <a name="mysql--client"></a>`mysql::client` Installs and configures the MySQL client. @@ -375,15 +375,15 @@ The following parameters are available in the `mysql::client` class: -* [`bindings_enable`](#bindings_enable) -* [`install_options`](#install_options) -* [`package_ensure`](#package_ensure) -* [`package_manage`](#package_manage) -* [`package_name`](#package_name) -* [`package_provider`](#package_provider) -* [`package_source`](#package_source) - -##### <a name="bindings_enable"></a>`bindings_enable` +* [`bindings_enable`](#-mysql--client--bindings_enable) +* [`install_options`](#-mysql--client--install_options) +* [`package_ensure`](#-mysql--client--package_ensure) +* [`package_manage`](#-mysql--client--package_manage) +* [`package_name`](#-mysql--client--package_name) +* [`package_provider`](#-mysql--client--package_provider) +* [`package_source`](#-mysql--client--package_source) + +##### <a name="-mysql--client--bindings_enable"></a>`bindings_enable` Data type: `Any` @@ -391,15 +391,15 @@ Default value: `$mysql::params::bindings_enable` -##### <a name="install_options"></a>`install_options` +##### <a name="-mysql--client--install_options"></a>`install_options` Data type: `Any` Array of install options for managed package resources. You must pass the appropriate options for the package manager. -Default value: ``undef`` - -##### <a name="package_ensure"></a>`package_ensure` +Default value: `undef` + +##### <a name="-mysql--client--package_ensure"></a>`package_ensure` Data type: `Any` @@ -407,7 +407,7 @@ Default value: `$mysql::params::client_package_ensure` -##### <a name="package_manage"></a>`package_manage` +##### <a name="-mysql--client--package_manage"></a>`package_manage` Data type: `Any` @@ -415,7 +415,7 @@ Default value: `$mysql::params::client_package_manage` -##### <a name="package_name"></a>`package_name` +##### <a name="-mysql--client--package_name"></a>`package_name` Data type: `Any` @@ -423,23 +423,23 @@ Default value: `$mysql::params::client_package_name` -##### <a name="package_provider"></a>`package_provider` +##### <a name="-mysql--client--package_provider"></a>`package_provider` Data type: `Any` -Default value: ``undef`` - -##### <a name="package_source"></a>`package_source` +Default value: `undef` + +##### <a name="-mysql--client--package_source"></a>`package_source` Data type: `Any` -Default value: ``undef`` - -### <a name="mysqlserver"></a>`mysql::server` +Default value: `undef` + +### <a name="mysql--server"></a>`mysql::server` Installs and configures the MySQL server. @@ -460,44 +460,43 @@ The following parameters are available in the `mysql::server` class: -* [`config_file`](#config_file) -* [`config_file_mode`](#config_file_mode) -* [`includedir`](#includedir) -* [`install_options`](#install_options) -* [`install_secret_file`](#install_secret_file) -* [`manage_config_file`](#manage_config_file) -* [`options`](#options) -* [`override_options`](#override_options) -* [`package_ensure`](#package_ensure) -* [`package_manage`](#package_manage) -* [`package_name`](#package_name) -* [`package_provider`](#package_provider) -* [`package_source`](#package_source) -* [`purge_conf_dir`](#purge_conf_dir) -* [`remove_default_accounts`](#remove_default_accounts) -* [`restart`](#restart) -* [`root_group`](#root_group) -* [`mysql_group`](#mysql_group) -* [`mycnf_owner`](#mycnf_owner) -* [`mycnf_group`](#mycnf_group) -* [`root_password`](#root_password) -* [`service_enabled`](#service_enabled) -* [`service_manage`](#service_manage) -* [`service_name`](#service_name) -* [`service_provider`](#service_provider) -* [`create_root_user`](#create_root_user) -* [`create_root_my_cnf`](#create_root_my_cnf) -* [`users`](#users) -* [`grants`](#grants) -* [`databases`](#databases) -* [`enabled`](#enabled) -* [`manage_service`](#manage_service) -* [`old_root_password`](#old_root_password) -* [`managed_dirs`](#managed_dirs) -* [`create_root_login_file`](#create_root_login_file) -* [`login_file`](#login_file) - -##### <a name="config_file"></a>`config_file` +* [`config_file`](#-mysql--server--config_file) +* [`config_file_mode`](#-mysql--server--config_file_mode) +* [`includedir`](#-mysql--server--includedir) +* [`install_options`](#-mysql--server--install_options) +* [`manage_config_file`](#-mysql--server--manage_config_file) +* [`options`](#-mysql--server--options) +* [`override_options`](#-mysql--server--override_options) +* [`package_ensure`](#-mysql--server--package_ensure) +* [`package_manage`](#-mysql--server--package_manage) +* [`package_name`](#-mysql--server--package_name) +* [`package_provider`](#-mysql--server--package_provider) +* [`package_source`](#-mysql--server--package_source) +* [`purge_conf_dir`](#-mysql--server--purge_conf_dir) +* [`remove_default_accounts`](#-mysql--server--remove_default_accounts) +* [`restart`](#-mysql--server--restart) +* [`root_group`](#-mysql--server--root_group) +* [`mysql_group`](#-mysql--server--mysql_group) +* [`mycnf_owner`](#-mysql--server--mycnf_owner) +* [`mycnf_group`](#-mysql--server--mycnf_group) +* [`root_password`](#-mysql--server--root_password) +* [`service_enabled`](#-mysql--server--service_enabled) +* [`service_manage`](#-mysql--server--service_manage) +* [`service_name`](#-mysql--server--service_name) +* [`service_provider`](#-mysql--server--service_provider) +* [`create_root_user`](#-mysql--server--create_root_user) +* [`create_root_my_cnf`](#-mysql--server--create_root_my_cnf) +* [`users`](#-mysql--server--users) +* [`grants`](#-mysql--server--grants) +* [`databases`](#-mysql--server--databases) +* [`enabled`](#-mysql--server--enabled) +* [`manage_service`](#-mysql--server--manage_service) +* [`old_root_password`](#-mysql--server--old_root_password) +* [`managed_dirs`](#-mysql--server--managed_dirs) +* [`create_root_login_file`](#-mysql--server--create_root_login_file) +* [`login_file`](#-mysql--server--login_file) + +##### <a name="-mysql--server--config_file"></a>`config_file` Data type: `Any` @@ -505,7 +504,7 @@ Default value: `$mysql::params::config_file` -##### <a name="config_file_mode"></a>`config_file_mode` +##### <a name="-mysql--server--config_file_mode"></a>`config_file_mode` Data type: `Any` @@ -513,7 +512,7 @@ Default value: `$mysql::params::config_file_mode` -##### <a name="includedir"></a>`includedir` +##### <a name="-mysql--server--includedir"></a>`includedir` Data type: `Any` @@ -521,23 +520,15 @@ Default value: `$mysql::params::includedir` -##### <a name="install_options"></a>`install_options` +##### <a name="-mysql--server--install_options"></a>`install_options` Data type: `Any` Passes [install_options](https://docs.puppetlabs.com/references/latest/type.html#package-attribute-install_options) array to managed package resources. You must pass the appropriate options for the specified package manager -Default value: ``undef`` - -##### <a name="install_secret_file"></a>`install_secret_file` - -Data type: `Any` - -Path to secret file containing temporary root password. - -Default value: `$mysql::params::install_secret_file` - -##### <a name="manage_config_file"></a>`manage_config_file` +Default value: `undef` + +##### <a name="-mysql--server--manage_config_file"></a>`manage_config_file` Data type: `Any` @@ -545,7 +536,7 @@ Default value: `$mysql::params::manage_config_file` -##### <a name="options"></a>`options` +##### <a name="-mysql--server--options"></a>`options` Data type: `Mysql::Options` @@ -553,7 +544,7 @@ Default value: `{}` -##### <a name="override_options"></a>`override_options` +##### <a name="-mysql--server--override_options"></a>`override_options` Data type: `Any` @@ -561,7 +552,7 @@ Default value: `{}` -##### <a name="package_ensure"></a>`package_ensure` +##### <a name="-mysql--server--package_ensure"></a>`package_ensure` Data type: `Any` @@ -569,7 +560,7 @@ Default value: `$mysql::params::server_package_ensure` -##### <a name="package_manage"></a>`package_manage` +##### <a name="-mysql--server--package_manage"></a>`package_manage` Data type: `Any` @@ -577,7 +568,7 @@ Default value: `$mysql::params::server_package_manage` -##### <a name="package_name"></a>`package_name` +##### <a name="-mysql--server--package_name"></a>`package_name` Data type: `Any` @@ -585,23 +576,23 @@ Default value: `$mysql::params::server_package_name` -##### <a name="package_provider"></a>`package_provider` +##### <a name="-mysql--server--package_provider"></a>`package_provider` Data type: `Any` Define a specific provider for package install. -Default value: ``undef`` - -##### <a name="package_source"></a>`package_source` +Default value: `undef` + +##### <a name="-mysql--server--package_source"></a>`package_source` Data type: `Any` The location of the package source (require for some package provider) -Default value: ``undef`` - -##### <a name="purge_conf_dir"></a>`purge_conf_dir` +Default value: `undef` + +##### <a name="-mysql--server--purge_conf_dir"></a>`purge_conf_dir` Data type: `Any` @@ -609,15 +600,15 @@ Default value: `$mysql::params::purge_conf_dir` -##### <a name="remove_default_accounts"></a>`remove_default_accounts` +##### <a name="-mysql--server--remove_default_accounts"></a>`remove_default_accounts` Data type: `Any` Specifies whether to automatically include `mysql::server::account_security`. Valid values are `true`, `false`. Defaults to `false`. -Default value: ``false`` - -##### <a name="restart"></a>`restart` +Default value: `false` + +##### <a name="-mysql--server--restart"></a>`restart` Data type: `Any` @@ -625,7 +616,7 @@ Default value: `$mysql::params::restart` -##### <a name="root_group"></a>`root_group` +##### <a name="-mysql--server--root_group"></a>`root_group` Data type: `Any` @@ -633,7 +624,7 @@ Default value: `$mysql::params::root_group` -##### <a name="mysql_group"></a>`mysql_group` +##### <a name="-mysql--server--mysql_group"></a>`mysql_group` Data type: `Any` @@ -641,7 +632,7 @@ Default value: `$mysql::params::mysql_group` -##### <a name="mycnf_owner"></a>`mycnf_owner` +##### <a name="-mysql--server--mycnf_owner"></a>`mycnf_owner` Data type: `Any` @@ -649,7 +640,7 @@ Default value: `$mysql::params::mycnf_owner` -##### <a name="mycnf_group"></a>`mycnf_group` +##### <a name="-mysql--server--mycnf_group"></a>`mycnf_group` Data type: `Any` @@ -657,7 +648,7 @@ Default value: `$mysql::params::mycnf_group` -##### <a name="root_password"></a>`root_password` +##### <a name="-mysql--server--root_password"></a>`root_password` Data type: `Variant[String, Sensitive[String]]` @@ -665,7 +656,7 @@ Default value: `$mysql::params::root_password` -##### <a name="service_enabled"></a>`service_enabled` +##### <a name="-mysql--server--service_enabled"></a>`service_enabled` Data type: `Any` @@ -673,7 +664,7 @@ Default value: `$mysql::params::server_service_enabled` -##### <a name="service_manage"></a>`service_manage` +##### <a name="-mysql--server--service_manage"></a>`service_manage` Data type: `Any` @@ -681,7 +672,7 @@ Default value: `$mysql::params::server_service_manage` -##### <a name="service_name"></a>`service_name` +##### <a name="-mysql--server--service_name"></a>`service_name` Data type: `Any` @@ -689,7 +680,7 @@ Default value: `$mysql::params::server_service_name` -##### <a name="service_provider"></a>`service_provider` +##### <a name="-mysql--server--service_provider"></a>`service_provider` Data type: `Any` @@ -697,7 +688,7 @@ Default value: `$mysql::params::server_service_provider` -##### <a name="create_root_user"></a>`create_root_user` +##### <a name="-mysql--server--create_root_user"></a>`create_root_user` Data type: `Any` @@ -705,7 +696,7 @@ Default value: `$mysql::params::create_root_user` -##### <a name="create_root_my_cnf"></a>`create_root_my_cnf` +##### <a name="-mysql--server--create_root_my_cnf"></a>`create_root_my_cnf` Data type: `Any` @@ -713,7 +704,7 @@ Default value: `$mysql::params::create_root_my_cnf` -##### <a name="users"></a>`users` +##### <a name="-mysql--server--users"></a>`users` Data type: `Any` @@ -721,7 +712,7 @@ Default value: `{}` -##### <a name="grants"></a>`grants` +##### <a name="-mysql--server--grants"></a>`grants` Data type: `Any` @@ -729,7 +720,7 @@ Default value: `{}` -##### <a name="databases"></a>`databases` +##### <a name="-mysql--server--databases"></a>`databases` Data type: `Any` @@ -737,31 +728,31 @@ Default value: `{}` -##### <a name="enabled"></a>`enabled` +##### <a name="-mysql--server--enabled"></a>`enabled` Data type: `Any` _Deprecated_ -Default value: ``undef`` - -##### <a name="manage_service"></a>`manage_service` +Default value: `undef` + +##### <a name="-mysql--server--manage_service"></a>`manage_service` Data type: `Any` _Deprecated_ -Default value: ``undef`` - -##### <a name="old_root_password"></a>`old_root_password` +Default value: `undef` + +##### <a name="-mysql--server--old_root_password"></a>`old_root_password` Data type: `Any` This parameter no longer does anything. It exists only for backwards compatibility. See the `root_password` parameter above for details on changing the root password. -Default value: ``undef`` - -##### <a name="managed_dirs"></a>`managed_dirs` +Default value: `undef` + +##### <a name="-mysql--server--managed_dirs"></a>`managed_dirs` Data type: `Any` @@ -769,7 +760,7 @@ Default value: `$mysql::params::managed_dirs` -##### <a name="create_root_login_file"></a>`create_root_login_file` +##### <a name="-mysql--server--create_root_login_file"></a>`create_root_login_file` Data type: `Any` @@ -777,7 +768,7 @@ Default value: `$mysql::params::create_root_login_file` -##### <a name="login_file"></a>`login_file` +##### <a name="-mysql--server--login_file"></a>`login_file` Data type: `Any` @@ -785,7 +776,7 @@ Default value: `$mysql::params::login_file` -### <a name="mysqlserverbackup"></a>`mysql::server::backup` +### <a name="mysql--server--backup"></a>`mysql::server::backup` Create and manage a MySQL backup. @@ -795,17 +786,26 @@ ```puppet class { 'mysql::server': - root_password => 'password' + root_password => 'password' } class { 'mysql::server::backup': - backupuser => 'myuser', - backuppassword => 'mypassword', - backupdir => '/tmp/backups', + backupuser => 'myuser', + backuppassword => 'mypassword', + backupdir => '/tmp/backups', +} +``` + +##### Create a basic MySQL backup using mariabackup: + +```puppet +class { 'mysql::server': + root_password => 'password' } class { 'mysql::server::backup': - backupmethod => 'mariabackup', - provider => 'xtrabackup', - backupdir => '/tmp/backups', + backupmethod => 'mariabackup', + backupmethod_package => 'mariadb-backup' + provider => 'xtrabackup', + backupdir => '/tmp/backups', } ``` @@ -813,60 +813,62 @@ The following parameters are available in the `mysql::server::backup` class: -* [`backupuser`](#backupuser) -* [`backuppassword`](#backuppassword) -* [`backupdir`](#backupdir) -* [`backupdirmode`](#backupdirmode) -* [`backupdirowner`](#backupdirowner) -* [`backupdirgroup`](#backupdirgroup) -* [`backupcompress`](#backupcompress) -* [`backupmethod`](#backupmethod) -* [`backup_success_file_path`](#backup_success_file_path) -* [`backuprotate`](#backuprotate) -* [`ignore_events`](#ignore_events) -* [`delete_before_dump`](#delete_before_dump) -* [`backupdatabases`](#backupdatabases) -* [`file_per_database`](#file_per_database) -* [`include_routines`](#include_routines) -* [`include_triggers`](#include_triggers) -* [`incremental_backups`](#incremental_backups) -* [`ensure`](#ensure) -* [`time`](#time) -* [`prescript`](#prescript) -* [`postscript`](#postscript) -* [`execpath`](#execpath) -* [`provider`](#provider) -* [`maxallowedpacket`](#maxallowedpacket) -* [`optional_args`](#optional_args) -* [`install_cron`](#install_cron) -* [`compression_command`](#compression_command) -* [`compression_extension`](#compression_extension) - -##### <a name="backupuser"></a>`backupuser` +* [`backupuser`](#-mysql--server--backup--backupuser) +* [`backuppassword`](#-mysql--server--backup--backuppassword) +* [`backupdir`](#-mysql--server--backup--backupdir) +* [`backupdirmode`](#-mysql--server--backup--backupdirmode) +* [`backupdirowner`](#-mysql--server--backup--backupdirowner) +* [`backupdirgroup`](#-mysql--server--backup--backupdirgroup) +* [`backupcompress`](#-mysql--server--backup--backupcompress) +* [`backupmethod`](#-mysql--server--backup--backupmethod) +* [`backup_success_file_path`](#-mysql--server--backup--backup_success_file_path) +* [`backuprotate`](#-mysql--server--backup--backuprotate) +* [`ignore_events`](#-mysql--server--backup--ignore_events) +* [`delete_before_dump`](#-mysql--server--backup--delete_before_dump) +* [`backupdatabases`](#-mysql--server--backup--backupdatabases) +* [`file_per_database`](#-mysql--server--backup--file_per_database) +* [`include_routines`](#-mysql--server--backup--include_routines) +* [`include_triggers`](#-mysql--server--backup--include_triggers) +* [`incremental_backups`](#-mysql--server--backup--incremental_backups) +* [`ensure`](#-mysql--server--backup--ensure) +* [`time`](#-mysql--server--backup--time) +* [`prescript`](#-mysql--server--backup--prescript) +* [`postscript`](#-mysql--server--backup--postscript) +* [`execpath`](#-mysql--server--backup--execpath) +* [`provider`](#-mysql--server--backup--provider) +* [`maxallowedpacket`](#-mysql--server--backup--maxallowedpacket) +* [`optional_args`](#-mysql--server--backup--optional_args) +* [`install_cron`](#-mysql--server--backup--install_cron) +* [`compression_command`](#-mysql--server--backup--compression_command) +* [`compression_extension`](#-mysql--server--backup--compression_extension) +* [`backupmethod_package`](#-mysql--server--backup--backupmethod_package) +* [`excludedatabases`](#-mysql--server--backup--excludedatabases) + +##### <a name="-mysql--server--backup--backupuser"></a>`backupuser` Data type: `Any` MySQL user to create with backup administrator privileges. -Default value: ``undef`` - -##### <a name="backuppassword"></a>`backuppassword` +Default value: `undef` + +##### <a name="-mysql--server--backup--backuppassword"></a>`backuppassword` Data type: `Optional[Variant[String, Sensitive[String]]]` Password to create for `backupuser`. -Default value: ``undef`` - -##### <a name="backupdir"></a>`backupdir` +Default value: `undef` + +##### <a name="-mysql--server--backup--backupdir"></a>`backupdir` Data type: `Any` Directory to store backup. -Default value: ``undef`` - -##### <a name="backupdirmode"></a>`backupdirmode` +Default value: `undef` + +##### <a name="-mysql--server--backup--backupdirmode"></a>`backupdirmode` Data type: `Any` @@ -874,7 +876,7 @@ Default value: `'0700'` -##### <a name="backupdirowner"></a>`backupdirowner` +##### <a name="-mysql--server--backup--backupdirowner"></a>`backupdirowner` Data type: `Any` @@ -882,7 +884,7 @@ Default value: `'root'` -##### <a name="backupdirgroup"></a>`backupdirgroup` +##### <a name="-mysql--server--backup--backupdirgroup"></a>`backupdirgroup` Data type: `Any` @@ -890,23 +892,23 @@ Default value: `$mysql::params::root_group` -##### <a name="backupcompress"></a>`backupcompress` +##### <a name="-mysql--server--backup--backupcompress"></a>`backupcompress` Data type: `Any` Whether or not to compress the backup (when using the mysqldump or xtrabackup provider) -Default value: ``true`` - -##### <a name="backupmethod"></a>`backupmethod` +Default value: `true` + +##### <a name="-mysql--server--backup--backupmethod"></a>`backupmethod` Data type: `Any` The execution binary for backing up. ex. mysqldump, xtrabackup, mariabackup -Default value: ``undef`` - -##### <a name="backup_success_file_path"></a>`backup_success_file_path` +Default value: `undef` + +##### <a name="-mysql--server--backup--backup_success_file_path"></a>`backup_success_file_path` Data type: `Any` @@ -914,7 +916,7 @@ Default value: `'/tmp/mysqlbackup_success'` -##### <a name="backuprotate"></a>`backuprotate` +##### <a name="-mysql--server--backup--backuprotate"></a>`backuprotate` Data type: `Any` @@ -922,23 +924,23 @@ Default value: `30` -##### <a name="ignore_events"></a>`ignore_events` +##### <a name="-mysql--server--backup--ignore_events"></a>`ignore_events` Data type: `Any` Ignore the mysql.event table. -Default value: ``true`` - -##### <a name="delete_before_dump"></a>`delete_before_dump` +Default value: `true` + +##### <a name="-mysql--server--backup--delete_before_dump"></a>`delete_before_dump` Data type: `Any` 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. -Default value: ``false`` - -##### <a name="backupdatabases"></a>`backupdatabases` +Default value: `false` + +##### <a name="-mysql--server--backup--backupdatabases"></a>`backupdatabases` Data type: `Any` @@ -946,39 +948,39 @@ Default value: `[]` -##### <a name="file_per_database"></a>`file_per_database` +##### <a name="-mysql--server--backup--file_per_database"></a>`file_per_database` Data type: `Any` Use file per database mode creating one file per database backup. -Default value: ``false`` - -##### <a name="include_routines"></a>`include_routines` +Default value: `false` + +##### <a name="-mysql--server--backup--include_routines"></a>`include_routines` Data type: `Any` Dump stored routines (procedures and functions) from dumped databases when doing a `file_per_database` backup. -Default value: ``false`` - -##### <a name="include_triggers"></a>`include_triggers` +Default value: `false` + +##### <a name="-mysql--server--backup--include_triggers"></a>`include_triggers` Data type: `Any` Dump triggers for each dumped table when doing a `file_per_database` backup. -Default value: ``false`` - -##### <a name="incremental_backups"></a>`incremental_backups` +Default value: `false` + +##### <a name="-mysql--server--backup--incremental_backups"></a>`incremental_backups` Data type: `Any` A flag to activate/deactivate incremental backups. Currently only supported by the xtrabackup provider. -Default value: ``true`` - -##### <a name="ensure"></a>`ensure` +Default value: `true` + +##### <a name="-mysql--server--backup--ensure"></a>`ensure` Data type: `Any` @@ -986,7 +988,7 @@ Default value: `'present'` -##### <a name="time"></a>`time` +##### <a name="-mysql--server--backup--time"></a>`time` Data type: `Any` @@ -994,23 +996,23 @@ Default value: `['23', '5']` -##### <a name="prescript"></a>`prescript` +##### <a name="-mysql--server--backup--prescript"></a>`prescript` Data type: `Any` A script that is executed before the backup begins. -Default value: ``false`` - -##### <a name="postscript"></a>`postscript` +Default value: `false` + +##### <a name="-mysql--server--backup--postscript"></a>`postscript` Data type: `Any` 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. -Default value: ``false`` - -##### <a name="execpath"></a>`execpath` +Default value: `false` + +##### <a name="-mysql--server--backup--execpath"></a>`execpath` Data type: `Any` @@ -1018,15 +1020,15 @@ Default value: `'/usr/bin:/usr/sbin:/bin:/sbin'` -##### <a name="provider"></a>`provider` +##### <a name="-mysql--server--backup--provider"></a>`provider` Data type: `Any` -Sets the server backup implementation. Valid values are: +Sets the server backup implementation. Valid values are: xtrabackup, mysqldump, mysqlbackup Default value: `'mysqldump'` -##### <a name="maxallowedpacket"></a>`maxallowedpacket` +##### <a name="-mysql--server--backup--maxallowedpacket"></a>`maxallowedpacket` Data type: `Any` @@ -1034,7 +1036,7 @@ Default value: `'1M'` -##### <a name="optional_args"></a>`optional_args` +##### <a name="-mysql--server--backup--optional_args"></a>`optional_args` Data type: `Any` @@ -1042,34 +1044,50 @@ Default value: `[]` -##### <a name="install_cron"></a>`install_cron` +##### <a name="-mysql--server--backup--install_cron"></a>`install_cron` Data type: `Any` Manage installation of cron package -Default value: ``true`` - -##### <a name="compression_command"></a>`compression_command` +Default value: `true` + +##### <a name="-mysql--server--backup--compression_command"></a>`compression_command` Data type: `Any` Configure the command used to compress the backup (when using the mysqldump provider). Make sure the command exists on the target system. Packages for it are NOT automatically installed. -Default value: ``undef`` - -##### <a name="compression_extension"></a>`compression_extension` +Default value: `undef` + +##### <a name="-mysql--server--backup--compression_extension"></a>`compression_extension` Data type: `Any` Configure the file extension for the compressed backup (when using the mysqldump provider) -Default value: ``undef`` +Default value: `undef` + +##### <a name="-mysql--server--backup--backupmethod_package"></a>`backupmethod_package` + +Data type: `Any` + +The package which provides the binary specified by the backupmethod parameter. + +Default value: `$mysql::params::xtrabackup_package_name` + +##### <a name="-mysql--server--backup--excludedatabases"></a>`excludedatabases` + +Data type: `Array[String]` + +Give a list of excluded databases when using file_per_database, e.g.: [ 'information_schema', 'performance_schema' ] + +Default value: `[]` ## Defined types -### <a name="mysqldb"></a>`mysql::db` +### <a name="mysql--db"></a>`mysql::db` Create and configure a MySQL database. @@ -1090,67 +1108,76 @@ The following parameters are available in the `mysql::db` defined type: -* [`user`](#user) -* [`password`](#password) -* [`tls_options`](#tls_options) -* [`dbname`](#dbname) -* [`charset`](#charset) -* [`collate`](#collate) -* [`host`](#host) -* [`grant`](#grant) -* [`grant_options`](#grant_options) -* [`sql`](#sql) -* [`enforce_sql`](#enforce_sql) -* [`ensure`](#ensure) -* [`import_timeout`](#import_timeout) -* [`import_cat_cmd`](#import_cat_cmd) -* [`mysql_exec_path`](#mysql_exec_path) - -##### <a name="user"></a>`user` +* [`name`](#-mysql--db--name) +* [`user`](#-mysql--db--user) +* [`password`](#-mysql--db--password) +* [`tls_options`](#-mysql--db--tls_options) +* [`dbname`](#-mysql--db--dbname) +* [`charset`](#-mysql--db--charset) +* [`collate`](#-mysql--db--collate) +* [`host`](#-mysql--db--host) +* [`grant`](#-mysql--db--grant) +* [`grant_options`](#-mysql--db--grant_options) +* [`sql`](#-mysql--db--sql) +* [`enforce_sql`](#-mysql--db--enforce_sql) +* [`ensure`](#-mysql--db--ensure) +* [`import_timeout`](#-mysql--db--import_timeout) +* [`import_cat_cmd`](#-mysql--db--import_cat_cmd) +* [`mysql_exec_path`](#-mysql--db--mysql_exec_path) + +##### <a name="-mysql--db--name"></a>`name` + +The name of the database to create. Database names must: + * be longer than 64 characters. + * not contain / \ or . characters. + * not contain characters that are not permitted in file names. + * not end with space characters. + +##### <a name="-mysql--db--user"></a>`user` Data type: `Any` The user for the database you're creating. -##### <a name="password"></a>`password` +##### <a name="-mysql--db--password"></a>`password` Data type: `Variant[String, Sensitive[String]]` The password for $user for the database you're creating. -##### <a name="tls_options"></a>`tls_options` +##### <a name="-mysql--db--tls_options"></a>`tls_options` Data type: `Any` The tls_options for $user for the database you're creating. -Default value: ``undef`` - -##### <a name="dbname"></a>`dbname` - -Data type: `Any` +Default value: `undef` + +##### <a name="-mysql--db--dbname"></a>`dbname` + +Data type: `String` The name of the database to create. Default value: `$name` -##### <a name="charset"></a>`charset` +##### <a name="-mysql--db--charset"></a>`charset` Data type: `Any` -The character set for the database. +The character set for the database. Must have the same value as collate to avoid corrective changes. See https://dev.mysql.com/doc/refman/8.0/en/charset-mysql.html for charset and collation pairs. Default value: `'utf8'` -##### <a name="collate"></a>`collate` +##### <a name="-mysql--db--collate"></a>`collate` Data type: `Any` -The collation for the database. +The collation for the database. Must have the same value as charset to avoid corrective changes. See https://dev.mysql.com/doc/refman/8.0/en/charset-mysql.html for charset and collation pairs. Default value: `'utf8_general_ci'` -##### <a name="host"></a>`host` +##### <a name="-mysql--db--host"></a>`host` Data type: `Any` @@ -1158,7 +1185,7 @@ Default value: `'localhost'` -##### <a name="grant"></a>`grant` +##### <a name="-mysql--db--grant"></a>`grant` Data type: `Any` @@ -1166,31 +1193,31 @@ Default value: `'ALL'` -##### <a name="grant_options"></a>`grant_options` +##### <a name="-mysql--db--grant_options"></a>`grant_options` Data type: `Any` The grant_options for the grant for user@host on the database. -Default value: ``undef`` - -##### <a name="sql"></a>`sql` - -Data type: `Optional[Variant[Array, Hash, String]]` - -The path to the sqlfile you want to execute. This can be single file specified as string, or it can be an array of strings. - -Default value: ``undef`` - -##### <a name="enforce_sql"></a>`enforce_sql` +Default value: `undef` + +##### <a name="-mysql--db--sql"></a>`sql` + +Data type: `Optional[Array]` + +The path to the sqlfile you want to execute. This can be an array containing one or more file paths. + +Default value: `undef` + +##### <a name="-mysql--db--enforce_sql"></a>`enforce_sql` Data type: `Any` Specifies whether executing the sqlfiles should happen on every run. If set to false, sqlfiles only run once. -Default value: ``false`` - -##### <a name="ensure"></a>`ensure` +Default value: `false` + +##### <a name="-mysql--db--ensure"></a>`ensure` Data type: `Enum['absent', 'present']` @@ -1198,7 +1225,7 @@ Default value: `'present'` -##### <a name="import_timeout"></a>`import_timeout` +##### <a name="-mysql--db--import_timeout"></a>`import_timeout` Data type: `Any` @@ -1206,21 +1233,21 @@ Default value: `300` -##### <a name="import_cat_cmd"></a>`import_cat_cmd` - -Data type: `Any` +##### <a name="-mysql--db--import_cat_cmd"></a>`import_cat_cmd` + +Data type: `Enum['cat', 'zcat', 'bzcat']` Command to read the sqlfile for importing the database. Useful for compressed sqlfiles. For example, you can use 'zcat' for .gz files. Default value: `'cat'` -##### <a name="mysql_exec_path"></a>`mysql_exec_path` +##### <a name="-mysql--db--mysql_exec_path"></a>`mysql_exec_path` Data type: `Any` -Default value: ``undef`` +Default value: `undef` ## Resource types @@ -1263,16 +1290,16 @@ The following parameters are available in the `mysql_grant` type. -* [`name`](#name) -* [`provider`](#provider) - -##### <a name="name"></a>`name` +* [`name`](#-mysql_grant--name) +* [`provider`](#-mysql_grant--provider) + +##### <a name="-mysql_grant--name"></a>`name` namevar Name to describe the grant. -##### <a name="provider"></a>`provider` +##### <a name="-mysql_grant--provider"></a>`provider` The specific backend to use for this `mysql_grant` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. @@ -1353,10 +1380,10 @@ The following parameters are available in the `mysql_login_path` type. -* [`name`](#name) -* [`owner`](#owner) - -##### <a name="name"></a>`name` +* [`name`](#-mysql_login_path--name) +* [`owner`](#-mysql_login_path--owner) + +##### <a name="-mysql_login_path--name"></a>`name` namevar @@ -1364,7 +1391,7 @@ Name of the login path you want to manage. -##### <a name="owner"></a>`owner` +##### <a name="-mysql_login_path--owner"></a>`owner` namevar @@ -1410,16 +1437,16 @@ The following parameters are available in the `mysql_plugin` type. -* [`name`](#name) -* [`provider`](#provider) - -##### <a name="name"></a>`name` +* [`name`](#-mysql_plugin--name) +* [`provider`](#-mysql_plugin--provider) + +##### <a name="-mysql_plugin--name"></a>`name` namevar The name of the MySQL plugin to manage. -##### <a name="provider"></a>`provider` +##### <a name="-mysql_plugin--provider"></a>`provider` The specific backend to use for this `mysql_plugin` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. @@ -1485,23 +1512,23 @@ The following parameters are available in the `mysql_user` type. -* [`name`](#name) -* [`provider`](#provider) - -##### <a name="name"></a>`name` +* [`name`](#-mysql_user--name) +* [`provider`](#-mysql_user--provider) + +##### <a name="-mysql_user--name"></a>`name` namevar The name of the user. This uses the 'username@hostname' or username@hostname. -##### <a name="provider"></a>`provider` +##### <a name="-mysql_user--provider"></a>`provider` The specific backend to use for this `mysql_user` resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform. ## Functions -### <a name="mysqlnormalise_and_deepmerge"></a>`mysql::normalise_and_deepmerge` +### <a name="mysql--normalise_and_deepmerge"></a>`mysql::normalise_and_deepmerge` Type: Ruby 4.x API @@ -1548,7 +1575,7 @@ Hash to be normalised -### <a name="mysqlpassword"></a>`mysql::password` +### <a name="mysql--password"></a>`mysql::password` Type: Ruby 4.x API @@ -1571,9 +1598,9 @@ Data type: `Optional[Boolean]` -If the Postgresql-Passwordhash should be of Datatype Sensitive[String] - -### <a name="mysqlstrip_hash"></a>`mysql::strip_hash` +If the mysql password hash should be of datatype Sensitive[String] + +### <a name="mysql--strip_hash"></a>`mysql::strip_hash` Type: Ruby 4.x API @@ -1618,15 +1645,11 @@ ## Data types -### <a name="mysqloptions"></a>`Mysql::Options` +### <a name="Mysql--Options"></a>`Mysql::Options` Use this if you don’t want your options merged with the default options. -Alias of - -```puppet -Hash[String, Hash] -``` +Alias of `Hash[String, Hash]` ## Tasks
--- a/modules/mysql/examples/monitor.pp Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/examples/monitor.pp Mon May 08 11:48:41 2023 +0100 @@ -3,7 +3,7 @@ $mysql_monitor_password = 'password' $mysql_monitor_username = 'monitoring' -$mysql_monitor_hostname = $::facts['networking']['hostname'] +$mysql_monitor_hostname = $facts['networking']['hostname'] mysql_user { "${mysql_monitor_username}@${mysql_monitor_hostname}": ensure => present,
--- a/modules/mysql/examples/mysql_db.pp Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/examples/mysql_db.pp Mon May 08 11:48:41 2023 +0100 @@ -7,11 +7,11 @@ host => 'localhost', grant => ['SELECT', 'UPDATE'], } -mysql::db { "mydb_${fqdn}": +mysql::db { "mydb_${facts['networking']['fqdn']}": user => 'myuser', password => 'mypass', dbname => 'mydb', - host => $::fqdn, + host => $facts['networking']['fqdn'], grant => ['SELECT', 'UPDATE'], tag => $domain, }
--- a/modules/mysql/examples/mysql_login_path.pp Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/examples/mysql_login_path.pp Mon May 08 11:48:41 2023 +0100 @@ -2,7 +2,7 @@ include apt apt::source { 'repo.mysql.com': location => 'http://repo.mysql.com/apt/debian', - release => $::lsbdistcodename, + release => $facts['os']['distro']['codename'], repos => 'mysql-8.0', key => { id => 'A4A9406876FCBD3C456770C88C718D3B5072E1F5', @@ -35,7 +35,7 @@ class { 'mysql::client': package_manage => false, package_name => 'mysql-community-client', - require => Class['::mysql::server'], + require => Class['mysql::server'], } mysql_login_path { 'client': @@ -54,7 +54,7 @@ password => Sensitive('blah'), port => 3306, owner => root, - require => Class['::mysql::server'], + require => Class['mysql::server'], } mysql_user { 'dan@localhost':
--- a/modules/mysql/examples/mysql_plugin.pp Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/examples/mysql_plugin.pp Mon May 08 11:48:41 2023 +0100 @@ -2,7 +2,7 @@ root_password => 'password', } -$validate_password_soname = $::osfamily ? { +$validate_password_soname = $facts['os']['family'] ? { 'windows' => 'validate_password.dll', default => 'validate_password.so' } @@ -12,7 +12,7 @@ soname => $validate_password_soname, } -$auth_socket_soname = $::osfamily ? { +$auth_socket_soname = $facts['os']['family'] ? { 'windows' => 'auth_socket.dll', default => 'auth_socket.so' }
--- a/modules/mysql/hiera.yaml Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/hiera.yaml Mon May 08 11:48:41 2023 +0100 @@ -11,8 +11,6 @@ # Used to distinguish between Debian and Ubuntu - "os/%{facts.os.name}/%{facts.os.release.major}.yaml" - "os/%{facts.os.family}/%{facts.os.release.major}.yaml" - # Used for Solaris - - "os/%{facts.os.family}/%{facts.kernelrelease}.yaml" - name: "osfamily" paths: - "os/%{facts.os.name}.yaml"
--- a/modules/mysql/lib/facter/mysql_server_id.rb Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/lib/facter/mysql_server_id.rb Mon May 08 11:48:41 2023 +0100 @@ -15,10 +15,8 @@ Facter.add('mysql_server_id') do setcode do - begin - mysql_id_get - rescue - nil - end + mysql_id_get + rescue + nil end end
--- a/modules/mysql/lib/facter/mysql_version.rb Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/lib/facter/mysql_version.rb Mon May 08 11:48:41 2023 +0100 @@ -3,7 +3,7 @@ Facter.add('mysql_version') do confine { Facter::Core::Execution.which('mysql') } setcode do - mysql_ver = Facter::Util::Resolution.exec('mysql --version') + mysql_ver = Facter::Core::Execution.execute('mysql --version') mysql_ver.match(%r{\d+\.\d+\.\d+})[0] if mysql_ver end end
--- a/modules/mysql/lib/facter/mysqld_version.rb Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/lib/facter/mysqld_version.rb Mon May 08 11:48:41 2023 +0100 @@ -1,8 +1,9 @@ # frozen_string_literal: true Facter.add('mysqld_version') do - confine { Facter::Core::Execution.which('mysqld') } + confine { Facter::Core::Execution.which('mysqld') || Facter::Core::Execution.which('/usr/libexec/mysqld') } setcode do - Facter::Util::Resolution.exec('mysqld --no-defaults -V 2>/dev/null') + # Add /usr/libexec to PATH to find mysqld command + Facter::Core::Execution.execute('env PATH=$PATH:/usr/libexec mysqld --no-defaults -V 2>/dev/null') end end
--- a/modules/mysql/lib/puppet/functions/mysql/password.rb Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/lib/puppet/functions/mysql/password.rb Mon May 08 11:48:41 2023 +0100 @@ -8,7 +8,7 @@ # @param password # Plain text password. # @param sensitive - # If the Postgresql-Passwordhash should be of Datatype Sensitive[String] + # If the mysql password hash should be of datatype Sensitive[String] # # @return hash # The mysql password hash from the clear text password.
--- a/modules/mysql/lib/puppet/provider/mysql_grant/mysql.rb Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/lib/puppet/provider/mysql_grant/mysql.rb Mon May 08 11:48:41 2023 +0100 @@ -7,7 +7,7 @@ commands mysql_raw: 'mysql' def self.instances - instances = [] + instance_configs = {} users.map do |user| user_string = cmd_user(user) query = "SHOW GRANTS FOR #{user_string};" @@ -45,13 +45,6 @@ (priv == 'ALL PRIVILEGES') ? 'ALL' : priv.strip end end - sorted_privileges = stripped_privileges.sort - if newer_than('mysql' => '8.0.0') && sorted_privileges == ['ALTER', 'ALTER ROUTINE', 'CREATE', 'CREATE ROLE', 'CREATE ROUTINE', 'CREATE TABLESPACE', 'CREATE TEMPORARY TABLES', 'CREATE USER', - 'CREATE VIEW', 'DELETE', 'DROP', 'DROP ROLE', 'EVENT', 'EXECUTE', 'FILE', 'INDEX', 'INSERT', 'LOCK TABLES', 'PROCESS', 'REFERENCES', - 'RELOAD', 'REPLICATION CLIENT', 'REPLICATION SLAVE', 'SELECT', 'SHOW DATABASES', 'SHOW VIEW', 'SHUTDOWN', 'SUPER', 'TRIGGER', - 'UPDATE'] - sorted_privileges = ['ALL'] - end # Same here, but to remove OPTION leaving just GRANT. options = if %r{WITH\sGRANT\sOPTION}.match?(rest) ['GRANT'] @@ -61,16 +54,56 @@ # fix double backslash that MySQL prints, so resources match table.gsub!('\\\\', '\\') # We need to return an array of instances so capture these - instances << new( - name: "#{user}@#{host}/#{table}", - ensure: :present, + name = "#{user}@#{host}/#{table}" + if instance_configs.key?(name) + instance_config = instance_configs[name] + stripped_privileges.concat instance_config[:privileges] + options.concat instance_config[:options] + end + + sorted_privileges = stripped_privileges.uniq.sort + if newer_than('mysql' => '8.0.0') && sorted_privileges == ['ALTER', 'ALTER ROUTINE', 'CREATE', 'CREATE ROLE', 'CREATE ROUTINE', 'CREATE TABLESPACE', 'CREATE TEMPORARY TABLES', 'CREATE USER', + 'CREATE VIEW', 'DELETE', 'DROP', 'DROP ROLE', 'EVENT', 'EXECUTE', 'FILE', 'INDEX', 'INSERT', 'LOCK TABLES', 'PROCESS', 'REFERENCES', + 'RELOAD', 'REPLICATION CLIENT', 'REPLICATION SLAVE', 'SELECT', 'SHOW DATABASES', 'SHOW VIEW', 'SHUTDOWN', 'SUPER', 'TRIGGER', + 'UPDATE'] + sorted_privileges = ['ALL'] + + # The following two elsif blocks of code are a workaround for issue #1474. + elsif sorted_privileges == ['ALL', 'APPLICATION_PASSWORD_ADMIN', 'AUDIT_ABORT_EXEMPT', 'AUDIT_ADMIN', 'AUTHENTICATION_POLICY_ADMIN', 'BACKUP_ADMIN', 'BINLOG_ADMIN', 'BINLOG_ENCRYPTION_ADMIN', + 'CLONE_ADMIN', 'CONNECTION_ADMIN', 'ENCRYPTION_KEY_ADMIN', 'FLUSH_OPTIMIZER_COSTS', 'FLUSH_STATUS', 'FLUSH_TABLES', 'FLUSH_USER_RESOURCES', + 'GROUP_REPLICATION_ADMIN', 'GROUP_REPLICATION_STREAM', 'INNODB_REDO_LOG_ARCHIVE', 'INNODB_REDO_LOG_ENABLE', 'PASSWORDLESS_USER_ADMIN', 'PERSIST_RO_VARIABLES_ADMIN', + 'REPLICATION_APPLIER', 'REPLICATION_SLAVE_ADMIN', 'RESOURCE_GROUP_ADMIN', 'RESOURCE_GROUP_USER', 'ROLE_ADMIN', 'SERVICE_CONNECTION_ADMIN', + 'SESSION_VARIABLES_ADMIN', 'SET_USER_ID', 'SHOW_ROUTINE', 'SYSTEM_USER', 'SYSTEM_VARIABLES_ADMIN', 'TABLE_ENCRYPTION_ADMIN', 'XA_RECOVER_ADMIN'] + sorted_privileges = ['ALL'] + + elsif sorted_privileges == ['ALL', 'APPLICATION_PASSWORD_ADMIN', 'AUDIT_ABORT_EXEMPT', 'AUDIT_ADMIN', 'AUTHENTICATION_POLICY_ADMIN', 'BACKUP_ADMIN', 'BINLOG_ADMIN', 'BINLOG_ENCRYPTION_ADMIN', + 'CLONE_ADMIN', 'CONNECTION_ADMIN', 'ENCRYPTION_KEY_ADMIN', 'FLUSH_OPTIMIZER_COSTS', 'FLUSH_STATUS', 'FLUSH_TABLES', 'FLUSH_USER_RESOURCES', + 'GROUP_REPLICATION_ADMIN', 'GROUP_REPLICATION_STREAM', 'INNODB_REDO_LOG_ARCHIVE', 'INNODB_REDO_LOG_ENABLE', 'PASSWORDLESS_USER_ADMIN', 'PERSIST_RO_VARIABLES_ADMIN', + 'REPLICATION_APPLIER', 'REPLICATION_SLAVE_ADMIN', 'RESOURCE_GROUP_ADMIN', 'RESOURCE_GROUP_USER', 'ROLE_ADMIN', 'SENSITIVE_VARIABLES_OBSERVER', + 'SERVICE_CONNECTION_ADMIN', 'SESSION_VARIABLES_ADMIN', 'SET_USER_ID', 'SHOW_ROUTINE', 'SYSTEM_USER', 'SYSTEM_VARIABLES_ADMIN', 'TABLE_ENCRYPTION_ADMIN', + 'XA_RECOVER_ADMIN'] + sorted_privileges = ['ALL'] + end + + instance_configs[name] = { privileges: sorted_privileges, table: table, user: "#{user}@#{host}", - options: options, - ) + options: options.uniq, + } end end + instances = [] + instance_configs.map do |name, config| + instances << new( + name: name, + ensure: :present, + privileges: config[:privileges], + table: config[:table], + user: config[:user], + options: config[:options], + ) + end instances end
--- a/modules/mysql/lib/puppet/provider/mysql_login_path/sensitive.rb Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/lib/puppet/provider/mysql_login_path/sensitive.rb Mon May 08 11:48:41 2023 +0100 @@ -6,4 +6,9 @@ def ==(other) return true if other.is_a?(Puppet::Pops::Types::PSensitiveType::Sensitive) && unwrap == other.unwrap end + + def encode_with(coder) + coder.tag = nil + coder.scalar = 'Puppet::Provider::MysqlLoginPath::Sensitive <<encrypted>>' + end end
--- a/modules/mysql/lib/puppet/provider/mysql_user/mysql.rb Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/lib/puppet/provider/mysql_user/mysql.rb Mon May 08 11:48:41 2023 +0100 @@ -27,7 +27,7 @@ @max_updates_per_hour, ssl_type, ssl_cipher, x509_issuer, x509_subject, @password, @plugin, @authentication_string = mysql_caller(query, 'regular').chomp.split(%r{\t}) @tls_options = parse_tls_options(ssl_type, ssl_cipher, x509_issuer, x509_subject) - if newer_than('mariadb' => '10.1.21') && @plugin == 'ed25519' + if newer_than('mariadb' => '10.1.21') && (@plugin == 'ed25519' || @plugin == 'mysql_native_password') # Some auth plugins (e.g. ed25519) use authentication_string # to store password hash or auth information @password = @authentication_string
--- a/modules/mysql/manifests/backup/mysqlbackup.pp Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/manifests/backup/mysqlbackup.pp Mon May 08 11:48:41 2023 +0100 @@ -4,33 +4,34 @@ # @api private # class mysql::backup::mysqlbackup ( - $backupuser = '', - Variant[String, Sensitive[String]] $backuppassword = '', - $maxallowedpacket = '1M', - $backupdir = '', - $backupdirmode = '0700', - $backupdirowner = 'root', - $backupdirgroup = $mysql::params::root_group, - $backupcompress = true, - $backuprotate = 30, - $backupmethod = '', - $backup_success_file_path = undef, - $ignore_events = true, - $delete_before_dump = false, - $backupdatabases = [], - $file_per_database = false, - $include_triggers = true, - $include_routines = false, - $ensure = 'present', - $time = ['23', '5'], - $prescript = false, - $postscript = false, - $execpath = '/usr/bin:/usr/sbin:/bin:/sbin', - $optional_args = [], - $incremental_backups = false, - $install_cron = true, - $compression_command = undef, - $compression_extension = undef, + String $backupuser = '', + Variant[String, Sensitive[String]] $backuppassword = '', + String[1] $maxallowedpacket = '1M', + String $backupdir = '', + String[1] $backupdirmode = '0700', + String[1] $backupdirowner = 'root', + String[1] $backupdirgroup = $mysql::params::root_group, + Boolean $backupcompress = true, + Variant[Integer, String[1]] $backuprotate = 30, + String $backupmethod = '', + Optional[String[1]] $backup_success_file_path = undef, + Boolean $ignore_events = true, + Boolean $delete_before_dump = false, + Array[String[1]] $backupdatabases = [], + Boolean $file_per_database = false, + Boolean $include_triggers = true, + Boolean $include_routines = false, + Enum['present', 'absent'] $ensure = 'present', + Variant[Array[String[1]], Array[Integer]] $time = ['23', '5'], + Variant[Boolean, String[1], Array[String[1]]] $prescript = false, + Variant[Boolean, String[1], Array[String[1]]] $postscript = false, + String[1] $execpath = '/usr/bin:/usr/sbin:/bin:/sbin', + Array[String[1]] $optional_args = [], + Boolean $incremental_backups = false, + Boolean $install_cron = true, + Optional[String[1]] $compression_command = undef, + Optional[String[1]] $compression_extension = undef, + Optional[String[1]] $backupmethod_package = undef, ) inherits mysql::params { $backuppassword_unsensitive = if $backuppassword =~ Sensitive { $backuppassword.unwrap @@ -73,9 +74,9 @@ } if $install_cron { - if $::osfamily == 'RedHat' { + if $facts['os']['family'] == 'RedHat' { ensure_packages('cronie') - } elsif $::osfamily != 'FreeBSD' { + } elsif $facts['os']['family'] != 'FreeBSD' { ensure_packages('cron') } } @@ -107,7 +108,7 @@ 'incremental_base' => 'history:last_backup', 'incremental_backup_dir' => $backupdir, 'user' => $backupuser, - 'password' => $backuppassword_unsensitive + 'password' => $backuppassword_unsensitive, }, } $options = mysql::normalise_and_deepmerge($default_options, $mysql::server::override_options)
--- a/modules/mysql/manifests/backup/mysqldump.pp Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/manifests/backup/mysqldump.pp Mon May 08 11:48:41 2023 +0100 @@ -3,35 +3,37 @@ # @api private # class mysql::backup::mysqldump ( - $backupuser = '', - Variant[String, Sensitive[String]] $backuppassword = '', - $backupdir = '', - $maxallowedpacket = '1M', - $backupdirmode = '0700', - $backupdirowner = 'root', - $backupdirgroup = $mysql::params::root_group, - $backupcompress = true, - $backuprotate = 30, - $backupmethod = 'mysqldump', - $backup_success_file_path = undef, - $ignore_events = true, - $delete_before_dump = false, - $backupdatabases = [], - $file_per_database = false, - $include_triggers = false, - $include_routines = false, - $ensure = 'present', - $time = ['23', '5'], - $prescript = false, - $postscript = false, - $execpath = '/usr/bin:/usr/sbin:/bin:/sbin', - $optional_args = [], - $mysqlbackupdir_ensure = 'directory', - $mysqlbackupdir_target = undef, - $incremental_backups = false, - $install_cron = true, - $compression_command = 'bzcat -zc', - $compression_extension = '.bz2' + String $backupuser = '', + Variant[String, Sensitive[String]] $backuppassword = '', + String $backupdir = '', + String[1] $maxallowedpacket = '1M', + String[1] $backupdirmode = '0700', + String[1] $backupdirowner = 'root', + String[1] $backupdirgroup = $mysql::params::root_group, + Boolean $backupcompress = true, + Variant[Integer, String[1]] $backuprotate = 30, + String[1] $backupmethod = 'mysqldump', + Optional[String[1]] $backup_success_file_path = undef, + Boolean $ignore_events = true, + Boolean $delete_before_dump = false, + Array[String[1]] $backupdatabases = [], + Boolean $file_per_database = false, + Boolean $include_triggers = false, + Boolean $include_routines = false, + Enum['present', 'absent'] $ensure = 'present', + Variant[Array[String[1]], Array[Integer]] $time = ['23', '5'], + Variant[Boolean, String[1], Array[String[1]]] $prescript = false, + Variant[Boolean, String[1], Array[String[1]]] $postscript = false, + String[1] $execpath = '/usr/bin:/usr/sbin:/bin:/sbin', + Array[String[1]] $optional_args = [], + String[1] $mysqlbackupdir_ensure = 'directory', + Optional[String[1]] $mysqlbackupdir_target = undef, + Boolean $incremental_backups = false, + Boolean $install_cron = true, + String[1] $compression_command = 'bzcat -zc', + String[1] $compression_extension = '.bz2', + Optional[String[1]] $backupmethod_package = undef, + Array[String] $excludedatabases = [], ) inherits mysql::params { $backuppassword_unsensitive = if $backuppassword =~ Sensitive { $backuppassword.unwrap @@ -39,7 +41,7 @@ $backuppassword } - unless $::osfamily == 'FreeBSD' { + unless $facts['os']['family'] == 'FreeBSD' { if $backupcompress and $compression_command == 'bzcat -zc' { ensure_packages(['bzip2']) Package['bzip2'] -> File['mysqlbackup.sh'] @@ -67,9 +69,9 @@ } if $install_cron { - if $::osfamily == 'RedHat' { + if $facts['os']['family'] == 'RedHat' { ensure_packages('cronie') - } elsif $::osfamily != 'FreeBSD' { + } elsif $facts['os']['family'] != 'FreeBSD' { ensure_packages('cron') } }
--- a/modules/mysql/manifests/backup/xtrabackup.pp Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/manifests/backup/xtrabackup.pp Mon May 08 11:48:41 2023 +0100 @@ -3,38 +3,39 @@ # @api private # class mysql::backup::xtrabackup ( - $xtrabackup_package_name = $mysql::params::xtrabackup_package_name, - $backupuser = undef, - Optional[Variant[String, Sensitive[String]]] $backuppassword = undef, - $backupdir = '', - $maxallowedpacket = '1M', - $backupmethod = 'xtrabackup', - $backupdirmode = '0700', - $backupdirowner = 'root', - $backupdirgroup = $mysql::params::root_group, - $backupcompress = true, - $backuprotate = 30, - $backupscript_template = 'mysql/xtrabackup.sh.erb', - $backup_success_file_path = undef, - $ignore_events = true, - $delete_before_dump = false, - $backupdatabases = [], - $file_per_database = false, - $include_triggers = true, - $include_routines = false, - $ensure = 'present', - $time = ['23', '5'], - $prescript = false, - $postscript = false, - $execpath = '/usr/bin:/usr/sbin:/bin:/sbin', - $optional_args = [], - $additional_cron_args = '--backup', - $incremental_backups = true, - $install_cron = true, - $compression_command = undef, - $compression_extension = undef, + Optional[String] $backupuser = undef, + Optional[Variant[String, Sensitive[String]]] $backuppassword = undef, + String $backupdir = '', + String[1] $maxallowedpacket = '1M', + String[1] $backupmethod = 'xtrabackup', + String[1] $backupdirmode = '0700', + String[1] $backupdirowner = 'root', + String[1] $backupdirgroup = $mysql::params::root_group, + Boolean $backupcompress = true, + Variant[Integer, String[1]] $backuprotate = 30, + String[1] $backupscript_template = 'mysql/xtrabackup.sh.erb', + Optional[String[1]] $backup_success_file_path = undef, + Boolean $ignore_events = true, + Boolean $delete_before_dump = false, + Array[String[1]] $backupdatabases = [], + Boolean $file_per_database = false, + Boolean $include_triggers = true, + Boolean $include_routines = false, + Enum['present', 'absent'] $ensure = 'present', + Variant[Array[String[1]], Array[Integer]] $time = ['23', '5'], + Variant[Boolean, String[1], Array[String[1]]] $prescript = false, + Variant[Boolean, String[1], Array[String[1]]] $postscript = false, + String[1] $execpath = '/usr/bin:/usr/sbin:/bin:/sbin', + Array[String[1]] $optional_args = [], + String[1] $additional_cron_args = '--backup', + Boolean $incremental_backups = true, + Boolean $install_cron = true, + Optional[String[1]] $compression_command = undef, + Optional[String[1]] $compression_extension = undef, + String[1] $backupmethod_package = $mysql::params::xtrabackup_package_name, + Array[String] $excludedatabases = [], ) inherits mysql::params { - ensure_packages($xtrabackup_package_name) + ensure_packages($backupmethod_package) $backuppassword_unsensitive = if $backuppassword =~ Sensitive { $backuppassword.unwrap @@ -48,20 +49,69 @@ password_hash => mysql::password($backuppassword), require => Class['mysql::server::root_password'], } - - mysql_grant { "${backupuser}@localhost/*.*": - ensure => $ensure, - user => "${backupuser}@localhost", - table => '*.*', - privileges => ['RELOAD', 'PROCESS', 'LOCK TABLES', 'REPLICATION CLIENT'], - require => Mysql_user["${backupuser}@localhost"], + # Percona XtraBackup needs additional grants/privileges to work with MySQL 8 + if versioncmp($facts['mysql_version'], '8') >= 0 and !(/(?i:mariadb)/ in $facts['mysqld_version']) { + if ($facts['os']['name'] == 'Debian' and versioncmp($facts['os']['release']['major'], '11') >= 0) or + ($facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['major'], '22.04') >= 0) { + mysql_grant { "${backupuser}@localhost/*.*": + ensure => $ensure, + user => "${backupuser}@localhost", + table => '*.*', + privileges => ['BINLOG MONITOR', 'RELOAD', 'PROCESS', 'LOCK TABLES', 'BACKUP_ADMIN'], + require => Mysql_user["${backupuser}@localhost"], + } + } + else { + mysql_grant { "${backupuser}@localhost/*.*": + ensure => $ensure, + user => "${backupuser}@localhost", + table => '*.*', + privileges => ['RELOAD', 'PROCESS', 'LOCK TABLES', 'REPLICATION CLIENT', 'BACKUP_ADMIN'], + require => Mysql_user["${backupuser}@localhost"], + } + } + mysql_grant { "${backupuser}@localhost/performance_schema.keyring_component_status": + ensure => $ensure, + user => "${backupuser}@localhost", + table => 'performance_schema.keyring_component_status', + privileges => ['SELECT'], + require => Mysql_user["${backupuser}@localhost"], + } + mysql_grant { "${backupuser}@localhost/performance_schema.log_status": + ensure => $ensure, + user => "${backupuser}@localhost", + table => 'performance_schema.log_status', + privileges => ['SELECT'], + require => Mysql_user["${backupuser}@localhost"], + } + } + else { + if $facts['os']['family'] == 'debian' and $facts['os']['release']['major'] == '11' or + ($facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['major'], '22.04') >= 0) { + mysql_grant { "${backupuser}@localhost/*.*": + ensure => $ensure, + user => "${backupuser}@localhost", + table => '*.*', + privileges => ['BINLOG MONITOR', 'RELOAD', 'PROCESS', 'LOCK TABLES'], + require => Mysql_user["${backupuser}@localhost"], + } + } + else { + mysql_grant { "${backupuser}@localhost/*.*": + ensure => $ensure, + user => "${backupuser}@localhost", + table => '*.*', + privileges => ['RELOAD', 'PROCESS', 'LOCK TABLES', 'REPLICATION CLIENT'], + require => Mysql_user["${backupuser}@localhost"], + } + } } } if $install_cron { - if $::osfamily == 'RedHat' { + if $facts['os']['family'] == 'RedHat' { ensure_packages('cronie') - } elsif $::osfamily != 'FreeBSD' { + } elsif $facts['os']['family'] != 'FreeBSD' { ensure_packages('cron') } } @@ -83,12 +133,12 @@ hour => $time[0], minute => $time[1], weekday => '0', - require => Package[$xtrabackup_package_name], + require => Package[$backupmethod_package], } } # Wether to use GNU or BSD date format. - case $::osfamily { + case $facts['os']['family'] { 'FreeBSD','OpenBSD': { $dateformat = '$(date -v-sun +\\%F)_full' } @@ -115,7 +165,7 @@ hour => $time[0], minute => $time[1], weekday => $daily_cron_data['weekday'], - require => Package[$xtrabackup_package_name], + require => Package[$backupmethod_package], } file { $backupdir:
--- a/modules/mysql/manifests/bindings.pp Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/manifests/bindings.pp Mon May 08 11:48:41 2023 +0100 @@ -25,91 +25,95 @@ # @param daemon_dev # Specifies whether `::mysql::bindings::daemon_dev` should be included. Valid values are `true`, `false`. # @param java_package_ensure -# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `java_enable => true`. +# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. +# Only applies if `java_enable => true`. # @param java_package_name # The name of the Java package to install. Only applies if `java_enable => true`. # @param java_package_provider # The provider to use to install the Java package. Only applies if `java_enable => true`. # @param perl_package_ensure -# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `perl_enable => true`. +# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. +# Only applies if `perl_enable => true`. # @param perl_package_name # The name of the Perl package to install. Only applies if `perl_enable => true`. # @param perl_package_provider # The provider to use to install the Perl package. Only applies if `perl_enable => true`. # @param php_package_ensure -# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `php_enable => true`. +# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. +# Only applies if `php_enable => true`. # @param php_package_name # The name of the PHP package to install. Only applies if `php_enable => true`. # @param php_package_provider # The provider to use to install the PHP package. Only applies if `php_enable => true`. # @param python_package_ensure -# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `python_enable => true`. +# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. +# Only applies if `python_enable => true`. # @param python_package_name # The name of the Python package to install. Only applies if `python_enable => true`. # @param python_package_provider # The provider to use to install the Python package. Only applies if `python_enable => true`. # @param ruby_package_ensure -# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `ruby_enable => true`. +# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. +# Only applies if `ruby_enable => true`. # @param ruby_package_name # The name of the Ruby package to install. Only applies if `ruby_enable => true`. # @param ruby_package_provider # What provider should be used to install the package. # @param client_dev_package_ensure -# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `client_dev => true`. +# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. +# Only applies if `client_dev => true`. # @param client_dev_package_name # The name of the client_dev package to install. Only applies if `client_dev => true`. # @param client_dev_package_provider # The provider to use to install the client_dev package. Only applies if `client_dev => true`. # @param daemon_dev_package_ensure -# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `daemon_dev => true`. +# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. +# Only applies if `daemon_dev => true`. # @param daemon_dev_package_name # The name of the daemon_dev package to install. Only applies if `daemon_dev => true`. # @param daemon_dev_package_provider # The provider to use to install the daemon_dev package. Only applies if `daemon_dev => true`. # class mysql::bindings ( - $install_options = undef, + Optional[Array[String[1]]] $install_options = undef, # Boolean to determine if we should include the classes. - $java_enable = false, - $perl_enable = false, - $php_enable = false, - $python_enable = false, - $ruby_enable = false, - $client_dev = false, - $daemon_dev = false, + Boolean $java_enable = false, + Boolean $perl_enable = false, + Boolean $php_enable = false, + Boolean $python_enable = false, + Boolean $ruby_enable = false, + Boolean $client_dev = false, + Boolean $daemon_dev = false, # Settings for the various classes. - $java_package_ensure = $mysql::params::java_package_ensure, - $java_package_name = $mysql::params::java_package_name, - $java_package_provider = $mysql::params::java_package_provider, - $perl_package_ensure = $mysql::params::perl_package_ensure, - $perl_package_name = $mysql::params::perl_package_name, - $perl_package_provider = $mysql::params::perl_package_provider, - $php_package_ensure = $mysql::params::php_package_ensure, - $php_package_name = $mysql::params::php_package_name, - $php_package_provider = $mysql::params::php_package_provider, - $python_package_ensure = $mysql::params::python_package_ensure, - $python_package_name = $mysql::params::python_package_name, - $python_package_provider = $mysql::params::python_package_provider, - $ruby_package_ensure = $mysql::params::ruby_package_ensure, - $ruby_package_name = $mysql::params::ruby_package_name, - $ruby_package_provider = $mysql::params::ruby_package_provider, - $client_dev_package_ensure = $mysql::params::client_dev_package_ensure, - $client_dev_package_name = $mysql::params::client_dev_package_name, - $client_dev_package_provider = $mysql::params::client_dev_package_provider, - $daemon_dev_package_ensure = $mysql::params::daemon_dev_package_ensure, - $daemon_dev_package_name = $mysql::params::daemon_dev_package_name, - $daemon_dev_package_provider = $mysql::params::daemon_dev_package_provider + Variant[Enum['present','absent'], Pattern[/(\d+)[\.](\d+)[\.](\d+)/]] $java_package_ensure = $mysql::params::java_package_ensure, + String[1] $java_package_name = $mysql::params::java_package_name, + Optional[String[1]] $java_package_provider = $mysql::params::java_package_provider, + Variant[Enum['present','absent'], Pattern[/(\d+)[\.](\d+)[\.](\d+)/]] $perl_package_ensure = $mysql::params::perl_package_ensure, + String[1] $perl_package_name = $mysql::params::perl_package_name, + Optional[String[1]] $perl_package_provider = $mysql::params::perl_package_provider, + Variant[Enum['present','absent'], Pattern[/(\d+)[\.](\d+)[\.](\d+)/]] $php_package_ensure = $mysql::params::php_package_ensure, + String[1] $php_package_name = $mysql::params::php_package_name, + Optional[String[1]] $php_package_provider = $mysql::params::php_package_provider, + Variant[Enum['present','absent'], Pattern[/(\d+)[\.](\d+)[\.](\d+)/]] $python_package_ensure = $mysql::params::python_package_ensure, + String[1] $python_package_name = $mysql::params::python_package_name, + Optional[String[1]] $python_package_provider = $mysql::params::python_package_provider, + Variant[Enum['present','absent'], Pattern[/(\d+)[\.](\d+)[\.](\d+)/]] $ruby_package_ensure = $mysql::params::ruby_package_ensure, + String[1] $ruby_package_name = $mysql::params::ruby_package_name, + Optional[String[1]] $ruby_package_provider = $mysql::params::ruby_package_provider, + Variant[Enum['present','absent'], Pattern[/(\d+)[\.](\d+)[\.](\d+)/]] $client_dev_package_ensure = $mysql::params::client_dev_package_ensure, + Optional[String[1]] $client_dev_package_name = $mysql::params::client_dev_package_name, + Optional[String[1]] $client_dev_package_provider = $mysql::params::client_dev_package_provider, + Variant[Enum['present','absent'], Pattern[/(\d+)[\.](\d+)[\.](\d+)/]] $daemon_dev_package_ensure = $mysql::params::daemon_dev_package_ensure, + String[1] $daemon_dev_package_name = $mysql::params::daemon_dev_package_name, + Optional[String[1]] $daemon_dev_package_provider = $mysql::params::daemon_dev_package_provider ) inherits mysql::params { - case $::osfamily { + case $facts['os']['family'] { 'Archlinux': { - if $java_enable { fail("::mysql::bindings::java cannot be managed by puppet on ${::facts['os']['family']} - as it is not in official repositories. Please disable java mysql binding.") } + if $java_enable { fail("::mysql::bindings::java cannot be managed by puppet on ${facts['os']['family']} as it is not in official repositories. Please disable java mysql binding.") } if $perl_enable { include 'mysql::bindings::perl' } - if $php_enable { warning("::mysql::bindings::php does not need to be managed by puppet on ${::facts['os']['family']} - as it is included in mysql package by default.") } + if $php_enable { warning("::mysql::bindings::php does not need to be managed by puppet on ${facts['os']['family']} as it is included in mysql package by default.") } if $python_enable { include 'mysql::bindings::python' } - if $ruby_enable { fail("::mysql::bindings::ruby cannot be managed by puppet on %{::facts['os']['family']} - as it is not in official repositories. Please disable ruby mysql binding.") } + if $ruby_enable { fail("::mysql::bindings::ruby cannot be managed by puppet on ${facts['os']['family']} as it is not in official repositories. Please disable ruby mysql binding.") } } default: {
--- a/modules/mysql/manifests/client.pp Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/manifests/client.pp Mon May 08 11:48:41 2023 +0100 @@ -18,15 +18,19 @@ # Whether to manage the MySQL client package. Defaults to `true`. # @param package_name # The name of the MySQL client package to install. +# @param package_provider +# Specify the provider of the package. Optional. Valid value is a String. +# @param package_source +# Specify the path to the package source. Optional. Valid value is a String # class mysql::client ( - $bindings_enable = $mysql::params::bindings_enable, - $install_options = undef, - $package_ensure = $mysql::params::client_package_ensure, - $package_manage = $mysql::params::client_package_manage, - $package_name = $mysql::params::client_package_name, - $package_provider = undef, - $package_source = undef, + Boolean $bindings_enable = $mysql::params::bindings_enable, + Optional[Array[String[1]]] $install_options = undef, + Variant[Enum['present','absent'], Pattern[/(\d+)[\.](\d+)[\.](\d+)/]] $package_ensure = $mysql::params::client_package_ensure, + Boolean $package_manage = $mysql::params::client_package_manage, + String[1] $package_name = $mysql::params::client_package_name, + Optional[String[1]] $package_provider = undef, + Optional[String[1]] $package_source = undef, ) inherits mysql::params { include 'mysql::client::install'
--- a/modules/mysql/manifests/db.pp Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/manifests/db.pp Mon May 08 11:48:41 2023 +0100 @@ -9,6 +9,12 @@ # grant => ['SELECT', 'UPDATE'], # } # +# @param name +# The name of the database to create. Database names must: +# * be longer than 64 characters. +# * not contain / \ or . characters. +# * not contain characters that are not permitted in file names. +# * not end with space characters. # @param user # The user for the database you're creating. # @param password @@ -18,9 +24,9 @@ # @param dbname # The name of the database to create. # @param charset -# The character set for the database. +# The character set for the database. Must have the same value as collate to avoid corrective changes. See https://dev.mysql.com/doc/refman/8.0/en/charset-mysql.html for charset and collation pairs. # @param collate -# The collation for the database. +# The collation for the database. Must have the same value as charset to avoid corrective changes. See https://dev.mysql.com/doc/refman/8.0/en/charset-mysql.html for charset and collation pairs. # @param host # The host to use as part of user@host for grants. # @param grant @@ -28,7 +34,7 @@ # @param grant_options # The grant_options for the grant for user@host on the database. # @param sql -# The path to the sqlfile you want to execute. This can be single file specified as string, or it can be an array of strings. +# The path to the sqlfile you want to execute. This can be an array containing one or more file paths. # @param enforce_sql # Specifies whether executing the sqlfiles should happen on every run. If set to false, sqlfiles only run once. # @param ensure @@ -37,29 +43,47 @@ # Timeout, in seconds, for loading the sqlfiles. Defaults to 300. # @param import_cat_cmd # Command to read the sqlfile for importing the database. Useful for compressed sqlfiles. For example, you can use 'zcat' for .gz files. +# @param mysql_exec_path +# Specify the path in which mysql has been installed if done in the non-standard bin/sbin path. # define mysql::db ( - $user, - Variant[String, Sensitive[String]] $password, - $tls_options = undef, - $dbname = $name, - $charset = 'utf8', - $collate = 'utf8_general_ci', - $host = 'localhost', - $grant = 'ALL', - $grant_options = undef, - Optional[Variant[Array, Hash, String]] $sql = undef, - $enforce_sql = false, - Enum['absent', 'present'] $ensure = 'present', - $import_timeout = 300, - $import_cat_cmd = 'cat', - $mysql_exec_path = undef, + String[1] $user, + Variant[String, Sensitive[String]] $password, + Optional[Array[String[1]]] $tls_options = undef, + String $dbname = $name, + String[1] $charset = 'utf8', + String[1] $collate = 'utf8_general_ci', + String[1] $host = 'localhost', + Variant[String[1], Array[String[1]]] $grant = 'ALL', + Optional[Variant[String[1], Array[String[1]]]] $grant_options = undef, + Optional[Array] $sql = undef, + Boolean $enforce_sql = false, + Enum['absent', 'present'] $ensure = 'present', + Integer $import_timeout = 300, + Enum['cat', 'zcat', 'bzcat'] $import_cat_cmd = 'cat', + Optional[String] $mysql_exec_path = undef, ) { - $table = "${dbname}.*" + include 'mysql::client' - $sql_inputs = join([$sql], ' ') + # Ensure that the database name is valid. + if $dbname !~ /^[^\/?%*:|\""<>.\s;]{1,64}$/ { + $message = "The database name '${dbname}' is invalid. Values must: + * be longer than 64 characters. + * not contain // \\ or . characters. + * not contain characters that are not permitted in file names. + * not end with space characters." + fail($message) + } - include 'mysql::client' + # Ensure that the sql files passed are valid file paths. + if $sql { + $sql.each | $sqlfile | { + if $sqlfile !~ /^\/(?:.[.A-Za-z0-9_-]+\/?+)+(?:\.[.A-Za-z0-9]+)+$/ { + $message = "The file '${sqlfile}' is invalid. A valid file path is expected." + fail($message) + } + } + } if ($mysql_exec_path) { $_mysql_exec_path = $mysql_exec_path @@ -84,6 +108,8 @@ ensure_resource('mysql_user', "${user}@${host}", $user_resource) if $ensure == 'present' { + $table = "${dbname}.*" + mysql_grant { "${user}@${host}/${table}": privileges => $grant, provider => 'mysql', @@ -96,14 +122,12 @@ ], } - $refresh = ! $enforce_sql - if $sql { exec { "${dbname}-import": - command => "${import_cat_cmd} ${sql_inputs} | mysql ${dbname}", + command => "${import_cat_cmd} ${shell_join($sql)} | mysql ${dbname}", logoutput => true, - environment => "HOME=${::root_home}", - refreshonly => $refresh, + environment => "HOME=${facts['root_home']}", + refreshonly => ! $enforce_sql, path => "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:${_mysql_exec_path}", require => Mysql_grant["${user}@${host}/${table}"], subscribe => Mysql_database[$dbname],
--- a/modules/mysql/manifests/params.pp Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/manifests/params.pp Mon May 08 11:48:41 2023 +0100 @@ -9,7 +9,6 @@ $purge_conf_dir = false $restart = false $root_password = 'UNSET' - $install_secret_file = '/.mysql_secret' $server_package_ensure = 'present' $server_package_manage = true $server_service_manage = true @@ -37,13 +36,12 @@ $client_dev_package_provider = undef $daemon_dev_package_ensure = 'present' $daemon_dev_package_provider = undef - $xtrabackup_package_name_default = 'percona-xtrabackup' - case $::osfamily { + case $facts['os']['family'] { 'RedHat': { - case $::operatingsystem { + case $facts['os']['name'] { 'Fedora': { - if versioncmp($::operatingsystemrelease, '19') >= 0 or $::operatingsystemrelease == 'Rawhide' { + if versioncmp($facts['os']['release']['full'], '19') >= 0 or $facts['os']['release']['full'] == 'Rawhide' { $provider = 'mariadb' } else { $provider = 'mysql' @@ -51,23 +49,23 @@ $python_package_name = 'MySQL-python' } 'Amazon': { - if versioncmp($::operatingsystemrelease, '2') >= 0 { + if versioncmp($facts['os']['release']['full'], '2') >= 0 { $provider = 'mariadb' } else { $provider = 'mysql' } } - /^(RedHat|Rocky|CentOS|Scientific|OracleLinux)$/: { - if versioncmp($::operatingsystemmajrelease, '7') >= 0 { + /^(RedHat|Rocky|CentOS|Scientific|OracleLinux|AlmaLinux)$/: { + if versioncmp($facts['os']['release']['major'], '7') >= 0 { $provider = 'mariadb' - if versioncmp($::operatingsystemmajrelease, '8') >= 0 { - $xtrabackup_package_name_override = 'percona-xtrabackup-24' + if versioncmp($facts['os']['release']['major'], '8') >= 0 { + $xtrabackup_package_name = 'percona-xtrabackup-24' } } else { $provider = 'mysql' - $xtrabackup_package_name_override = 'percona-xtrabackup-20' + $xtrabackup_package_name = 'percona-xtrabackup-20' } - if versioncmp($::operatingsystemmajrelease, '8') >= 0 { + if versioncmp($facts['os']['release']['major'], '8') >= 0 { $java_package_name = 'mariadb-java-client' $python_package_name = 'python3-PyMySQL' } else { @@ -121,7 +119,7 @@ } 'Suse': { - case $::operatingsystem { + case $facts['os']['name'] { 'OpenSuSE': { $socket = '/var/run/mysql/mysql.sock' $log_error = '/var/log/mysql/mysqld.log' @@ -143,7 +141,7 @@ $basedir = undef } default: { - fail("Unsupported platform: puppetlabs-${module_name} currently doesn\'t support ${::operatingsystem}.") + fail("Unsupported platform: puppetlabs-${module_name} currently doesn\'t support ${facts['os']['name']}.") } } $config_file = '/etc/my.cnf' @@ -154,7 +152,7 @@ $mycnf_owner = undef $mycnf_group = undef $server_service_name = 'mysql' - $xtrabackup_package_name_override = 'xtrabackup' + $xtrabackup_package_name = 'xtrabackup' $ssl_ca = '/etc/mysql/cacert.pem' $ssl_cert = '/etc/mysql/server-cert.pem' @@ -171,9 +169,10 @@ } 'Debian': { - if $::operatingsystem == 'Debian' { + if $facts['os']['name'] == 'Debian' or $facts['os']['name'] == 'Raspbian' or + ($facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['major'], '20.04') >= 0) { $provider = 'mariadb' - } else { # Ubuntu + } else { $provider = 'mysql' } if $provider == 'mariadb' { @@ -208,26 +207,26 @@ $managed_dirs = ['tmpdir','basedir','datadir','innodb_data_home_dir','innodb_log_group_home_dir','innodb_undo_directory','innodb_tmpdir'] # mysql::bindings - if ($::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '10') >= 0) or - ($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '20.04') >= 0) { + if ($facts['os']['name'] == 'Debian' and versioncmp($facts['os']['release']['full'], '10') >= 0) or + ($facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['full'], '20.04') >= 0) { $java_package_name = 'libmariadb-java' } else { $java_package_name = 'libmysql-java' } $perl_package_name = 'libdbd-mysql-perl' - if ($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '16.04') >= 0) or - ($::operatingsystem == 'Debian') { + if ($facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['full'], '16.04') >= 0) or + ($facts['os']['name'] == 'Debian') { $php_package_name = 'php-mysql' } else { $php_package_name = 'php5-mysql' } - if ($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '16.04') < 0) or - ($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '20.04') >= 0) or - ($::operatingsystem == 'Debian') { - $xtrabackup_package_name_override = 'percona-xtrabackup-24' + if ($facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['full'], '16.04') < 0) or + ($facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['full'], '20.04') >= 0) or + ($facts['os']['name'] == 'Debian') { + $xtrabackup_package_name = 'percona-xtrabackup-24' } - if ($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '20.04') >= 0) or - ($::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '11') >= 0){ + if ($facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['full'], '20.04') >= 0) or + ($facts['os']['name'] == 'Debian' and versioncmp($facts['os']['release']['full'], '11') >= 0) { $python_package_name = 'python3-mysqldb' } else { $python_package_name = 'python-mysqldb' @@ -236,9 +235,11 @@ $ruby_package_name = $facts['os']['release']['major'] ? { '9' => 'ruby-mysql2', # stretch '10' => 'ruby-mysql2', # buster + '11' => 'ruby-mysql2', # bullseye '16.04' => 'ruby-mysql', # xenial '18.04' => 'ruby-mysql2', # bionic '20.04' => 'ruby-mysql2', # focal + '22.04' => 'ruby-mysql2', # jammy default => 'libmysql-ruby', } } @@ -339,7 +340,7 @@ $config_file = '/etc/my.cnf' $includedir = undef $datadir = '/var/mysql' - $log_error = "/var/mysql/${::hostname}.err" + $log_error = "/var/mysql/${facts['networking']['hostname']}.err" $pidfile = '/var/mysql/mysql.pid' $root_group = 'wheel' $mysql_group = '_mysql' @@ -363,35 +364,8 @@ $daemon_dev_package_name = undef } - 'Solaris': { - $client_package_name = 'database/mysql-55/client' - $server_package_name = 'database/mysql-55' - $basedir = undef - $config_file = '/etc/mysql/5.5/my.cnf' - $datadir = '/var/mysql/5.5/data' - $log_error = "/var/mysql/5.5/data/${::hostname}.err" - $pidfile = "/var/mysql/5.5/data/${::hostname}.pid" - $root_group = 'bin' - $server_service_name = 'application/database/mysql:version_55' - $socket = '/tmp/mysql.sock' - $ssl_ca = undef - $ssl_cert = undef - $ssl_key = undef - $tmpdir = '/tmp' - $managed_dirs = undef - # mysql::bindings - $java_package_name = undef - $perl_package_name = undef - $php_package_name = 'web/php-53/extension/php-mysql' - $python_package_name = 'library/python/python-mysql' - $ruby_package_name = undef - # The libraries installed by these packages are included in client and server packages, no installation required. - $client_dev_package_name = undef - $daemon_dev_package_name = undef - } - default: { - case $::operatingsystem { + case $facts['os']['name'] { 'Alpine': { $client_package_name = 'mariadb-client' $server_package_name = 'mariadb' @@ -451,13 +425,13 @@ } default: { - fail("Unsupported platform: puppetlabs-${module_name} currently doesn\'t support ${::osfamily} or ${::operatingsystem}.") + fail("Unsupported platform: puppetlabs-${module_name} currently doesn\'t support ${facts['os']['family']} or ${facts['os']['name']}.") } } } } - case $::operatingsystem { + case $facts['os']['name'] { 'Ubuntu': { $server_service_provider = 'systemd' } @@ -537,14 +511,12 @@ }, } - if defined('$xtrabackup_package_name_override') { - $xtrabackup_package_name = pick($xtrabackup_package_name_override, $xtrabackup_package_name_default) - } else { - $xtrabackup_package_name = $xtrabackup_package_name_default + if !defined('$xtrabackup_package_name') { + $xtrabackup_package_name = 'percona-xtrabackup' } ## Additional graceful failures - if $::osfamily == 'RedHat' and $::operatingsystemmajrelease == '4' and $::operatingsystem != 'Amazon' { + if $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '4' and $facts['os']['name'] != 'Amazon' { fail("Unsupported platform: puppetlabs-${module_name} only supports RedHat 6.0 and beyond.") } }
--- a/modules/mysql/manifests/server.pp Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/manifests/server.pp Mon May 08 11:48:41 2023 +0100 @@ -17,12 +17,11 @@ # The location, as a path, of !includedir for custom configuration overrides. # @param install_options # Passes [install_options](https://docs.puppetlabs.com/references/latest/type.html#package-attribute-install_options) array to managed package resources. You must pass the appropriate options for the specified package manager -# @param install_secret_file -# Path to secret file containing temporary root password. # @param manage_config_file # Whether the MySQL configuration file should be managed. Valid values are `true`, `false`. Defaults to `true`. # @param options -# A hash of options structured like the override_options, but not merged with the default options. Use this if you don't want your options merged with the default options. +# A hash of options structured like the override_options, but not merged with the default options. +# Use this if you don't want your options merged with the default options. # @param override_options # Specifies override options to pass into MySQL. Structured like a hash in the my.cnf file: See above for usage details. # @param package_ensure @@ -43,6 +42,8 @@ # Whether the service should be restarted when things change. Valid values are `true`, `false`. Defaults to `false`. # @param root_group # The name of the group used for root. Can be a group name or a group ID. See more about the [group](https://docs.puppetlabs.com/references/latest/type.html#file-attribute-group). +# @param managed_dirs +# An array containing all directories to be managed. # @param mysql_group # The name of the group of the MySQL daemon user. Can be a group name or a group ID. See more about the [group](https://docs.puppetlabs.com/references/latest/type.html#file-attribute-group). # @param mycnf_owner @@ -50,7 +51,11 @@ # @param mycnf_group # Name or group-id which owns the mysql-config-file. # @param root_password -# The MySQL root password. Puppet attempts to set the root password and update `/root/.my.cnf` with it. This is required if `create_root_user` or `create_root_my_cnf` are true. If `root_password` is 'UNSET', then `create_root_user` and `create_root_my_cnf` are assumed to be false --- that is, the MySQL root user and `/root/.my.cnf` are not created. Password changes are supported; however, the old password must be set in `/root/.my.cnf`. Effectively, Puppet uses the old password, configured in `/root/my.cnf`, to set the new password in MySQL, and then updates `/root/.my.cnf` with the new password. +# The MySQL root password. Puppet attempts to set the root password and update `/root/.my.cnf` with it. This is required +# if `create_root_user` or `create_root_my_cnf` are true. If `root_password` is 'UNSET', then `create_root_user` and +# `create_root_my_cnf` are assumed to be false --- that is, the MySQL root user and `/root/.my.cnf` are not created. +# Password changes are supported; however, the old password must be set in `/root/.my.cnf`. Effectively, Puppet uses the old +# password, configured in `/root/my.cnf`, to set the new password in MySQL, and then updates `/root/.my.cnf` with the new password. # @param service_enabled # Specifies whether the service should be enabled. Valid values are `true`, `false`. Defaults to `true`. # @param service_manage @@ -60,9 +65,17 @@ # @param service_provider # The provider to use to manage the service. For Ubuntu, defaults to 'upstart'; otherwise, default is undefined. # @param create_root_user -# Whether root user should be created. Valid values are `true`, `false`. Defaults to `true`. This is useful for a cluster setup with Galera. The root user has to be created only once. You can set this parameter true on one node and set it to false on the remaining nodes. +# Whether root user should be created. Valid values are `true`, `false`. Defaults to `true`. +# This is useful for a cluster setup with Galera. The root user has to be created only once. +# You can set this parameter true on one node and set it to false on the remaining nodes. # @param create_root_my_cnf -# Whether to create `/root/.my.cnf`. Valid values are `true`, `false`. Defaults to `true`. `create_root_my_cnf` allows creation of `/root/.my.cnf` independently of `create_root_user`. You can use this for a cluster setup with Galera where you want `/root/.my.cnf` to exist on all nodes. +# Whether to create `/root/.my.cnf`. Valid values are `true`, `false`. Defaults to `true`. +# `create_root_my_cnf` allows creation of `/root/.my.cnf` independently of `create_root_user`. +# You can use this for a cluster setup with Galera where you want `/root/.my.cnf` to exist on all nodes. +# @param create_root_login_file +# Whether to create a login file for root. Valid values are 'true', 'false'. +# @param login_file +# Specify the login file. # @param users # Optional hash of users to create, which are passed to [mysql_user](#mysql_user). # @param grants @@ -74,46 +87,46 @@ # @param manage_service # _Deprecated_ # @param old_root_password -# This parameter no longer does anything. It exists only for backwards compatibility. See the `root_password` parameter above for details on changing the root password. +# This parameter no longer does anything. It exists only for backwards compatibility. +# See the `root_password` parameter above for details on changing the root password. # class mysql::server ( - $config_file = $mysql::params::config_file, - $config_file_mode = $mysql::params::config_file_mode, - $includedir = $mysql::params::includedir, - $install_options = undef, - $install_secret_file = $mysql::params::install_secret_file, - $manage_config_file = $mysql::params::manage_config_file, - Mysql::Options $options = {}, - $override_options = {}, - $package_ensure = $mysql::params::server_package_ensure, - $package_manage = $mysql::params::server_package_manage, - $package_name = $mysql::params::server_package_name, - $package_provider = undef, - $package_source = undef, - $purge_conf_dir = $mysql::params::purge_conf_dir, - $remove_default_accounts = false, - $restart = $mysql::params::restart, - $root_group = $mysql::params::root_group, - $managed_dirs = $mysql::params::managed_dirs, - $mysql_group = $mysql::params::mysql_group, - $mycnf_owner = $mysql::params::mycnf_owner, - $mycnf_group = $mysql::params::mycnf_group, - Variant[String, Sensitive[String]] $root_password = $mysql::params::root_password, - $service_enabled = $mysql::params::server_service_enabled, - $service_manage = $mysql::params::server_service_manage, - $service_name = $mysql::params::server_service_name, - $service_provider = $mysql::params::server_service_provider, - $create_root_user = $mysql::params::create_root_user, - $create_root_my_cnf = $mysql::params::create_root_my_cnf, - $create_root_login_file = $mysql::params::create_root_login_file, - $login_file = $mysql::params::login_file, - $users = {}, - $grants = {}, - $databases = {}, + String[1] $config_file = $mysql::params::config_file, + String[1] $config_file_mode = $mysql::params::config_file_mode, + Optional[String] $includedir = $mysql::params::includedir, + Optional[Array[String[1]]] $install_options = undef, + Variant[Boolean, String[1]] $manage_config_file = $mysql::params::manage_config_file, + Mysql::Options $options = {}, + Hash $override_options = {}, + Variant[Enum['present','absent'], Pattern[/(\d+)[\.](\d+)[\.](\d+)/]] $package_ensure = $mysql::params::server_package_ensure, + Boolean $package_manage = $mysql::params::server_package_manage, + String[1] $package_name = $mysql::params::server_package_name, + Optional[String[1]] $package_provider = undef, + Optional[String[1]] $package_source = undef, + Variant[Boolean, String[1]] $purge_conf_dir = $mysql::params::purge_conf_dir, + Variant[Boolean, String[1]] $remove_default_accounts = false, + Variant[Boolean, String[1]] $restart = $mysql::params::restart, + String[1] $root_group = $mysql::params::root_group, + Optional[Array[String[1]]] $managed_dirs = $mysql::params::managed_dirs, + String[1] $mysql_group = $mysql::params::mysql_group, + Optional[String[1]] $mycnf_owner = $mysql::params::mycnf_owner, + Optional[String[1]] $mycnf_group = $mysql::params::mycnf_group, + Variant[String, Sensitive[String]] $root_password = $mysql::params::root_password, + Variant[Boolean, String[1]] $service_enabled = $mysql::params::server_service_enabled, + Variant[Boolean, String[1]] $service_manage = $mysql::params::server_service_manage, + String[1] $service_name = $mysql::params::server_service_name, + Optional[String[1]] $service_provider = $mysql::params::server_service_provider, + Boolean $create_root_user = $mysql::params::create_root_user, + Boolean $create_root_my_cnf = $mysql::params::create_root_my_cnf, + Boolean $create_root_login_file = $mysql::params::create_root_login_file, + Optional[String[1]] $login_file = $mysql::params::login_file, + Hash $users = {}, + Hash $grants = {}, + Hash $databases = {}, # Deprecated parameters - $enabled = undef, - $manage_service = undef, - $old_root_password = undef + Optional[Variant[String[1], Boolean]] $enabled = undef, + Optional[Variant[String[1], Boolean]] $manage_service = undef, + Optional[Variant[String, Sensitive[String]]] $old_root_password = undef ) inherits mysql::params { # Deprecated parameters. if $enabled { @@ -167,6 +180,13 @@ ~> Class['mysql::server::service'] } + if $_options['mysqld']['ssl-disable'] { + notify { 'ssl-disable': + message => 'Disabling SSL is evil! You should never ever do this except + if you are forced to use a mysql version compiled without SSL support', + } + } + Anchor['mysql::server::start'] -> Class['mysql::server::config'] -> Class['mysql::server::install'] @@ -175,4 +195,5 @@ -> Class['mysql::server::service'] -> Class['mysql::server::root_password'] -> Class['mysql::server::providers'] --> Anchor['mysql::server::end'] } + -> Anchor['mysql::server::end'] +}
--- a/modules/mysql/manifests/server/account_security.pp Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/manifests/server/account_security.pp Mon May 08 11:48:41 2023 +0100 @@ -12,7 +12,7 @@ ensure => 'absent', require => Anchor['mysql::server::end'], } - if ($::fqdn != 'localhost.localdomain') { + if ($facts['networking']['fqdn'] != 'localhost.localdomain') { mysql_user { ['root@localhost.localdomain', '@localhost.localdomain']: @@ -20,17 +20,17 @@ require => Anchor['mysql::server::end'], } } - if ($::fqdn and $::fqdn != 'localhost') { + if ($facts['networking']['fqdn'] and $facts['networking']['fqdn'] != 'localhost') { mysql_user { - ["root@${::fqdn}", - "@${::fqdn}"]: + ["root@${facts['networking']['fqdn']}", + "@${facts['networking']['fqdn']}"]: ensure => 'absent', require => Anchor['mysql::server::end'], } } - if ($::fqdn != $::hostname) { - if ($::hostname != 'localhost') { - mysql_user { ["root@${::hostname}", "@${::hostname}"]: + if ($facts['networking']['fqdn'] != $facts['networking']['hostname']) { + if ($facts['networking']['hostname'] != 'localhost') { + mysql_user { ["root@${facts['networking']['hostname']}", "@${facts['networking']['hostname']}"]: ensure => 'absent', require => Anchor['mysql::server::end'], }
--- a/modules/mysql/manifests/server/backup.pp Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/manifests/server/backup.pp Mon May 08 11:48:41 2023 +0100 @@ -3,17 +3,23 @@ # # @example Create a basic MySQL backup: # class { 'mysql::server': -# root_password => 'password' +# root_password => 'password' # } # class { 'mysql::server::backup': -# backupuser => 'myuser', -# backuppassword => 'mypassword', -# backupdir => '/tmp/backups', +# backupuser => 'myuser', +# backuppassword => 'mypassword', +# backupdir => '/tmp/backups', +# } +# +# @example Create a basic MySQL backup using mariabackup: +# class { 'mysql::server': +# root_password => 'password' # } # class { 'mysql::server::backup': -# backupmethod => 'mariabackup', -# provider => 'xtrabackup', -# backupdir => '/tmp/backups', +# backupmethod => 'mariabackup', +# backupmethod_package => 'mariadb-backup' +# provider => 'xtrabackup', +# backupdir => '/tmp/backups', # } # # @param backupuser @@ -39,7 +45,8 @@ # @param ignore_events # Ignore the mysql.event table. # @param delete_before_dump -# 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. +# 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. # @param backupdatabases # Databases to backup (required if using xtrabackup provider). By default `[]` will back up all databases. # @param file_per_database @@ -56,15 +63,18 @@ # @param prescript # A script that is executed before the backup begins. # @param postscript -# 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. +# 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. # @param execpath # Allows you to set a custom PATH should your MySQL installation be non-standard places. Defaults to `/usr/bin:/usr/sbin:/bin:/sbin`. # @param provider -# Sets the server backup implementation. Valid values are: +# Sets the server backup implementation. Valid values are: xtrabackup, mysqldump, mysqlbackup # @param maxallowedpacket # Defines the maximum SQL statement size for the backup dump script. The default value is 1MB, as this is the default MySQL Server value. # @param optional_args -# Specifies an array of optional arguments which should be passed through to the backup tool. (Supported by the xtrabackup and mysqldump providers.) +# Specifies an array of optional arguments which should be passed through to the backup tool. +# (Supported by the xtrabackup and mysqldump providers.) # @param install_cron # Manage installation of cron package # @param compression_command @@ -72,35 +82,41 @@ # on the target system. Packages for it are NOT automatically installed. # @param compression_extension # Configure the file extension for the compressed backup (when using the mysqldump provider) +# @param backupmethod_package +# The package which provides the binary specified by the backupmethod parameter. +# @param excludedatabases +# Give a list of excluded databases when using file_per_database, e.g.: [ 'information_schema', 'performance_schema' ] class mysql::server::backup ( - $backupuser = undef, - Optional[Variant[String, Sensitive[String]]] $backuppassword = undef, - $backupdir = undef, - $backupdirmode = '0700', - $backupdirowner = 'root', - $backupdirgroup = $mysql::params::root_group, - $backupcompress = true, - $backuprotate = 30, - $backupmethod = undef, - $backup_success_file_path = '/tmp/mysqlbackup_success', - $ignore_events = true, - $delete_before_dump = false, - $backupdatabases = [], - $file_per_database = false, - $include_routines = false, - $include_triggers = false, - $ensure = 'present', - $time = ['23', '5'], - $prescript = false, - $postscript = false, - $execpath = '/usr/bin:/usr/sbin:/bin:/sbin', - $provider = 'mysqldump', - $maxallowedpacket = '1M', - $optional_args = [], - $incremental_backups = true, - $install_cron = true, - $compression_command = undef, - $compression_extension = undef + Optional[String[1]] $backupuser = undef, + Optional[Variant[String, Sensitive[String]]] $backuppassword = undef, + Optional[String[1]] $backupdir = undef, + String[1] $backupdirmode = '0700', + String[1] $backupdirowner = 'root', + String[1] $backupdirgroup = $mysql::params::root_group, + Boolean $backupcompress = true, + Variant[String[1], Integer] $backuprotate = 30, + Optional[String[1]] $backupmethod = undef, + String[1] $backup_success_file_path = '/tmp/mysqlbackup_success', + Boolean $ignore_events = true, + Boolean $delete_before_dump = false, + Array[String[1]] $backupdatabases = [], + Boolean $file_per_database = false, + Boolean $include_routines = false, + Boolean $include_triggers = false, + Variant[Enum['present','absent'], Pattern[/(\d+)[\.](\d+)[\.](\d+)/]] $ensure = 'present', + Variant[Array[String[1]], Array[Integer]] $time = ['23', '5'], + Variant[Boolean, String[1], Array[String[1]]] $prescript = false, + Variant[Boolean, String[1], Array[String[1]]] $postscript = false, + String[1] $execpath = '/usr/bin:/usr/sbin:/bin:/sbin', + Enum['xtrabackup', 'mysqldump', 'mysqlbackup'] $provider = 'mysqldump', + String[1] $maxallowedpacket = '1M', + Array[String[1]] $optional_args = [], + Boolean $incremental_backups = true, + Boolean $install_cron = true, + Optional[String[1]] $compression_command = undef, + Optional[String[1]] $compression_extension = undef, + String[1] $backupmethod_package = $mysql::params::xtrabackup_package_name, + Array[String] $excludedatabases = [], ) inherits mysql::params { if $prescript and $provider =~ /(mysqldump|mysqlbackup)/ { warning("The 'prescript' option is not currently implemented for the ${provider} backup provider.") @@ -135,6 +151,8 @@ 'install_cron' => $install_cron, 'compression_command' => $compression_command, 'compression_extension' => $compression_extension, + 'backupmethod_package' => $backupmethod_package, + 'excludedatabases' => $excludedatabases, } }) }
--- a/modules/mysql/manifests/server/config.pp Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/manifests/server/config.pp Mon May 08 11:48:41 2023 +0100 @@ -34,19 +34,24 @@ } #Debian: Creating world readable directories before installing. - case $::operatingsystem { + case $facts['os']['family'] { 'Debian': { if $managed_dirs { $managed_dirs.each | $entry | { $dir = $options['mysqld']["${entry}"] + if ( $dir and $dir != '/usr' and $dir != '/tmp' ) { + $clean_dir = shell_escape($dir) + $clean_package_name = shell_escape($mysql::server::package_name) + exec { "${entry}-managed_dir-mkdir": - command => "/bin/mkdir -p ${dir}", - unless => "/usr/bin/dpkg -s ${mysql::server::package_name}", + command => ['/bin/mkdir', '-p', $clean_dir], + unless => [['/usr/bin/dpkg', '-s', $clean_package_name]], notify => Exec["${entry}-managed_dir-chmod"], } + exec { "${entry}-managed_dir-chmod": - command => "/bin/chmod 777 ${dir}", + command => ['/bin/chmod', '777', $clean_dir], refreshonly => true, } } @@ -82,11 +87,4 @@ } } } - - if $options['mysqld']['ssl-disable'] { - notify { 'ssl-disable': - message => 'Disabling SSL is evil! You should never ever do this except - if you are forced to use a mysql version compiled without SSL support', - } - } }
--- a/modules/mysql/manifests/server/root_password.pp Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/manifests/server/root_password.pp Mon May 08 11:48:41 2023 +0100 @@ -16,20 +16,15 @@ } $options = $mysql::server::_options - $secret_file = $mysql::server::install_secret_file $login_file = $mysql::server::login_file # New installations of MySQL will configure a default random password for the root user # with an expiration. No actions can be performed until this password is changed. The # below exec will remove this default password. If the user has supplied a root # password it will be set further down with the mysql_user resource. - $rm_pass_cmd = join([ - "mysqladmin -u root --password=\$(grep -o '[^ ]\\+\$' ${secret_file}) password ''", - "rm -f ${secret_file}", - ], ' && ') exec { 'remove install pass': - command => $rm_pass_cmd, - onlyif => "test -f ${secret_file}", + command => "mysqladmin -u root --password=\$(grep -o '[^ ]\\+\$' /.mysql_secret) password && (rm -f /.mysql_secret; exit 0) || (rm -f /.mysql_secret; exit 1)", + onlyif => [['test', '-f' ,'/.mysql_secret']], path => '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin', } @@ -44,23 +39,23 @@ if $mysql::server::create_root_my_cnf and $root_password_set { # TODO: use EPP instead of ERB, as EPP can handle Data of Type Sensitive without further ado - file { "${::root_home}/.my.cnf": + file { "${facts['root_home']}/.my.cnf": content => template('mysql/my.cnf.pass.erb'), owner => 'root', mode => '0600', } # show_diff was added with puppet 3.0 - if versioncmp($::puppetversion, '3.0') >= 0 { - File["${::root_home}/.my.cnf"] { show_diff => false } + if versioncmp($facts['puppetversion'], '3.0') >= 0 { + File["${facts['root_home']}/.my.cnf"] { show_diff => false } } if $mysql::server::create_root_user { - Mysql_user['root@localhost'] -> File["${::root_home}/.my.cnf"] + Mysql_user['root@localhost'] -> File["${facts['root_home']}/.my.cnf"] } } if $mysql::server::create_root_login_file and $root_password_set { - file { "${::root_home}/.mylogin.cnf": + file { "${facts['root_home']}/.mylogin.cnf": source => $login_file, owner => 'root', mode => '0600',
--- a/modules/mysql/manifests/server/service.pp Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/manifests/server/service.pp Mon May 08 11:48:41 2023 +0100 @@ -52,10 +52,11 @@ $mysqlsocket = $options['mysqld']['socket'] } + $test_command = ['test', '-S', shell_escape($mysqlsocket)] if $service_ensure != 'stopped' { exec { 'wait_for_mysql_socket_to_open': - command => "test -S ${mysqlsocket}", - unless => "test -S ${mysqlsocket}", + command => $test_command, + unless => [$test_command], tries => '3', try_sleep => '10', require => Service['mysqld'],
--- a/modules/mysql/metadata.json Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/metadata.json Mon May 08 11:48:41 2023 +0100 @@ -1,6 +1,6 @@ { "name": "puppetlabs-mysql", - "version": "12.0.1", + "version": "13.2.0", "author": "puppetlabs", "summary": "Installs, configures, and manages the MySQL service.", "license": "Apache-2.0", @@ -17,15 +17,14 @@ { "operatingsystem": "RedHat", "operatingsystemrelease": [ - "6", "7", - "8" + "8", + "9" ] }, { "operatingsystem": "CentOS", "operatingsystemrelease": [ - "6", "7", "8" ] @@ -33,14 +32,19 @@ { "operatingsystem": "OracleLinux", "operatingsystemrelease": [ - "6", "7" ] }, { + "operatingsystem": "Debian", + "operatingsystemrelease": [ + "10", + "11" + ] + }, + { "operatingsystem": "Scientific", "operatingsystemrelease": [ - "6", "7" ] }, @@ -54,20 +58,32 @@ { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "16.04", "18.04", - "20.04" + "20.04", + "22.04" + ] + }, + { + "operatingsystem": "Rocky", + "operatingsystemrelease": [ + "8" + ] + }, + { + "operatingsystem": "AlmaLinux", + "operatingsystemrelease": [ + "8" ] } ], "requirements": [ { "name": "puppet", - "version_requirement": ">= 6.0.0 < 8.0.0" + "version_requirement": ">= 6.24.0 < 8.0.0" } ], "description": "MySQL module", "template-url": "https://github.com/puppetlabs/pdk-templates#main", - "template-ref": "heads/main-0-g51828b4", - "pdk-version": "2.2.0" + "template-ref": "2.7.1-0-g9a16c87", + "pdk-version": "2.5.0" }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/mysql/pdk.yaml Mon May 08 11:48:41 2023 +0100 @@ -0,0 +1,2 @@ +--- +ignore: []
--- a/modules/mysql/readmes/README_ja_JP.md Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/readmes/README_ja_JP.md Mon May 08 11:48:41 2023 +0100 @@ -107,11 +107,11 @@ エクスポートされたリソースを含む別のリソース名を使用するには、次のようにします。 ```puppet - @@mysql::db { "mydb_${fqdn}": + @@mysql::db { "mydb_${facts['networking']['fqdn']}": user => 'myuser', password => 'mypass', dbname => 'mydb', - host => ${fqdn}, + host => ${facts['networking']['fqdn']}, grant => ['SELECT', 'UPDATE'], tag => $domain, }
--- a/modules/mysql/templates/my.cnf.erb Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/templates/my.cnf.erb Mon May 08 11:48:41 2023 +0100 @@ -4,7 +4,7 @@ <% if v.is_a?(Hash) -%> [<%= k %>] <% v.sort.map do |ki, vi| -%> -<% if ki == 'ssl-disable' or (ki =~ /^ssl/ and v['ssl-disable'] == true) -%> +<% if ki == 'ssl-disable' or (ki =~ /^ssl/ and v['ssl-disable'] == true) or (ki =~ /^ssl-/ and v['ssl'] == false) -%> <% next %> <% elsif vi == true or vi == '' -%> <%= ki %>
--- a/modules/mysql/templates/mysqlbackup.sh.erb Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/templates/mysqlbackup.sh.erb Mon May 08 11:48:41 2023 +0100 @@ -22,11 +22,7 @@ # Create temporary mysql cnf file. TMPFILE=`mktemp /tmp/backup.XXXXXX` || exit 1 -<%- if @kernel == 'SunOS' -%> -echo "[client]\npassword=$PASS\nuser=$USER\nmax_allowed_packet=$MAX_ALLOWED_PACKET" > $TMPFILE -<%- else -%> echo -e "[client]\npassword=$PASS\nuser=$USER\nmax_allowed_packet=$MAX_ALLOWED_PACKET" > $TMPFILE -<%- end -%> <% if @prescript -%> <%- [@prescript].flatten.compact.each do |script|%> @@ -76,11 +72,7 @@ cleanup() { -<%- if @kernel == 'SunOS' -%> - gfind "${DIR}/" -maxdepth 1 -type f -name "${PREFIX}*.sql*" -mtime +${ROTATE} -print0 | gxargs -0 -r rm -f -<%- else -%> find "${DIR}/" -maxdepth 1 -type f -name "${PREFIX}*.sql*" -mtime +${ROTATE} -print0 | xargs -0 -r rm -f -<%- end -%> } <% if @delete_before_dump -%> @@ -89,7 +81,11 @@ <% end -%> <% if @backupdatabases.empty? -%> <% if @file_per_database -%> +<% if @excludedatabases.empty? -%> mysql --defaults-extra-file=$TMPFILE -s -r -N -e 'SHOW DATABASES' | while read dbname +<% else -%> +mysql --defaults-extra-file=$TMPFILE -s -r -N -e 'SHOW DATABASES' | grep -v '^\(<%= @excludedatabases.join('|') %>\)$' | while read dbname +<% end -%> do <%= @backupmethod -%> --defaults-extra-file=$TMPFILE --opt --flush-logs --single-transaction \ ${ADDITIONAL_OPTIONS} \
--- a/modules/mysql/templates/xtrabackup.sh.erb Mon Apr 03 19:41:02 2023 +0100 +++ b/modules/mysql/templates/xtrabackup.sh.erb Mon May 08 11:48:41 2023 +0100 @@ -25,11 +25,7 @@ cleanup() { - <%- if @kernel == 'SunOS' -%> - gfind "${DIR}/" -mindepth 1 -maxdepth 1 -mtime +${ROTATE} -print0 | gxargs -0 -r rm -rf - <%- else -%> find "${DIR}/" -mindepth 1 -maxdepth 1 -mtime +${ROTATE} -print0 | xargs -0 -r rm -rf - <%- end -%> } <% if @delete_before_dump -%> @@ -63,7 +59,9 @@ <% unless @delete_before_dump -%> if [ $? -eq 0 ] ; then cleanup + <% if @backup_success_file_path -%> touch <%= @backup_success_file_path %> + <% end -%> fi <% end -%>