Commit Graph

120 Commits

Author SHA1 Message Date
Jimmy McCrory 3f02976760 Additional TLS configuration options
Add variables `galera_require_secure_transport` and `galera_tls_version`
for requiring encrypted connections to the server and providing the list
of permitted protocols of those connections when `galera_use_ssl` is
enabled.

Change-Id: I28c548a5ee778c4957dc73e3547d585344755c0f
Depends-On: I6b77c828d251aeee53b83404e7e3131e3f61cbb1
Depends-On: I23d839e75b202d0400aeefe6e98c429e16ecd37e
2024-03-11 11:02:48 -07:00
Jonathan Rosser e697948b34 Bump version to latest stable release of MariaDB 10.11
Change-Id: I9735ecba0db5cffd8b3c2b0e24a41bcfa5856a0e
2024-01-15 17:52:50 +00:00
Jonathan Rosser 28ac2fc7ee Bump galera version to 10.11.5
The repo for this point release includes packages for debian bookworm.

Change-Id: Ifeb558d92ff1a153ecd523f7f2897e143a66933c
2023-10-17 11:08:05 +00:00
David Hitze 3e2afc1e4e Added vars to override systemd for mariabackup
Added variables ``galera_backups_full_init_overrides`` and
``galera_backups_increment_init_overrides`` that can be leveraged to
override default set of systemd unit file for mariadb backups.

Change-Id: Ib15c60dc577b376b1f761c4266eea89c4cb0be9f
2023-09-11 15:34:38 +02:00
Dmitriy Rabotyagov 91f578f2c0 Fix linters issue and metadata
With update of ansible-lint to version >=6.0.0 a lot of new
linters were added, that enabled by default. In order to comply
with linter rules we're applying changes to the role.

With that we also update metdata to reflect current state.

Change-Id: I13935aa1ae19449184053fc40cc64b09ed1ba9ef
2023-08-09 14:42:56 +00:00
Simon Hensel 60009ed7ce Add optional compression to mariabackup
As database backups can grow substantially in size, compressing backups
helps to preserve disk space.
While the mariabackup utility offers no compression by itself, we can
stream the backup into a compression tool to create an archive [1].
The xtrabackup_checkpoints file, which contains metadata on a backup,
gets stored alongside the archive, allowing to create incremental
backups from non-compressed backups and vice-versa [2].
One thing to note, is that compressed backups cannot be prepared in
advance, this step must be manually carried out by the user.
Backup compression is disabled by default and different compressors
can be chosen (zstd, xz, ...), with gzip being the default.

[1] https://mariadb.com/kb/en/using-encryption-and-compression-tools-with-mariabackup/
[2] https://mariadb.com/kb/en/incremental-backup-and-restore-with-mariabackup/#combining-with-stream-output

Change-Id: I28c6a0e0b41d4d29c3e79e601de45ea373dee4fb
Signed-off-by: Simon Hensel <simon.hensel@inovex.de>
2023-06-20 15:34:39 +02:00
Dmitriy Rabotyagov 92b5711b94 Define backup randomized delay in defaults
Omit can not be used in timer options, since this is simple mapping
that is passed to the unit file. With that, omit is resolved to a
randomly named omit_place_holder  that ends up in a template.

Se we define a delay to 0, which is default systemd behaviour [1]

[1] https://www.freedesktop.org/software/systemd/man/systemd.timer.html#RandomizedDelaySec=

Change-Id: Ib242e66cfb4a24b7e93144e382e50f124015e3bf
2023-04-20 12:10:14 +00:00
Dmitriy Rabotyagov 515bec4165 Upgrade MariaDB to 10.11
10.11 is the next LTS release of MariaDB which has been released
recently. Let's switch to using new LTS from 10.6 that we're using
for quite a while now.

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/879069
Change-Id: I430acf61fd4fdacdead19d0c5cc2765e017eb3c7
2023-03-31 17:22:15 +00:00
Dmitriy Rabotyagov e04aeacc58 Bump mariadb version to 10.6.10
With that we also able to use MariaDB provided repo for
Ubuntu 22.04 and CentOS Stream/Rocky 9

Change-Id: I4181691ba3b23c5195b3cee3699637ece94187db
2022-10-06 08:35:42 +00:00
Andrew Bonney 5200b50cf6 Add the ability to specify custom additional galera users
This provides the capability to add and remove additional users
in the Galera database which may be used by external resource
monitoring systems (for example).

The Ansible mysql 'resource_limits' variable is also exposed to
enable setting connection limits against individual users.

Change-Id: Idcc9251340215baf5e6f550a9ca844c8c097d353
2022-09-12 13:24:37 +01:00
Christian Rohmann ae0e53a9be Allow setting of RandomizedDelaySec for backup systemd timers
By allowing for a random delay for the OnCalendar timers it's possible
to run backups on multiple nodes without having them happen at the exact
same time. By omitting the option by default the current behavior remains
unchanged.

Change-Id: I005cf8ba94ab043d7075039975d5f0bc250f9187
2022-09-01 13:06:54 +02:00
Christian Rohmann a5835fd611 Add support to configure proxy-protocol-networks
MariaDB/Galera can read information about the actual client
connecting via a load balancer from the proxy protocol.
In order to define which sources are trusted the parameter
`proxy-protocol-networks` is used.

See https://mariadb.com/kb/en/proxy-protocol-support

Change-Id: I4ea360fbea5a911ba03a5eca3af00eb91b7bd124
2022-08-29 15:34:38 +02:00
Dmitriy Rabotyagov 85c0e127e8 Switch galera_root_user default value
Change galera_root_user default value from root to admin. It's general
recommendation not to mess up with root user and not adjust/use it
anywhere except by system. We've changed value for OSA
several cycles ago and now it's time to change defaults in role.

Change-Id: I18e868927bded594ba482f1463e999f6bd6ee0da
2022-06-24 10:48:35 +02:00
Zuul 8b102ff94b Merge "Add lost+found to list of ignored db dirs" 2022-06-03 10:23:51 +00:00
Zuul 96a6ccc077 Merge "Bump mariadb version." 2022-05-27 17:23:31 +00:00
Zuul cd73bd5108 Merge "Add support for centos-9" 2022-05-25 23:35:23 +00:00
Christian Rohmann 001e26963b Add lost+found to list of ignored db dirs
In case an ext filesystem is used for the datadir a directory
`lost+found` exists and is recreated on every mount. It's sensible
to ignore this directory as mysql otherwise expects this to be yet
another db.

Change-Id: I2ca7817108709211d8246310482216a255fd9752
2022-05-23 12:00:05 +02:00
Marc Gariepy 1013ee3a5d Bump mariadb version.
This bump will fix:
https://nvd.nist.gov/vuln/detail/CVE-2022-27376
https://nvd.nist.gov/vuln/detail/CVE-2022-27377
https://nvd.nist.gov/vuln/detail/CVE-2022-27380

Change-Id: I90286b01b5578df04447155c69c92f823388185a
2022-05-17 09:39:39 -04:00
Christian Rohmann 6c383a92a5 Move slow_query_log_file to location handled by logrotation
Currently slow_query_log_file is not set and the default of `host_name-slow.log` is applied.
This causes an ever growing slow log to fill up `/var/lib/mysql` and which is never rotated.

By placing this file at `/var/log/mysql/mariadb-slow.log` it will be rotated by the bundled
logrotate config of the `mysql-server` package.

Change-Id: Ib66eb5c6bdf94b6c6f4461a7f6e339c1000e0afc
2022-05-17 09:05:27 +00:00
Jonathan Rosser d083461eb0 Add support for centos-9
This uses the distro package for mariadb as there is no release from
mariadb.org yet.

Change-Id: I41cdbb82b6ef82ea7acb4d22ca29aac84efebe30
2022-05-12 14:20:19 +01:00
Dmitriy Rabotyagov 515daa62f0 Update MariaDB version to 10.6.7
We also modify workaround applied for 10.6 upgrade wrt to bug [1]
as it has been added extra tools to help with checking state of upgrade.

New flag --check-if-upgrade-is-needed is checking if any upgrade is
already running and waits until it's finished.
It exits with rc 0 if upgrade is required and 1 if not.

If upgrade is required, we fall into rescue and perform upgrade.

[1] https://jira.mariadb.org/browse/MDEV-27068

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/835091
Change-Id: I8f32eb32388c23284b7e0272f6a0fbb7235c443d
2022-04-27 13:37:26 +01:00
Zuul 81615669c6 Merge "Add galera_data_dir variable" 2022-04-25 20:17:13 +00:00
Zuul 992ac7740f Merge "Use separate tmp directory" 2022-04-25 20:14:41 +00:00
Dmitriy Rabotyagov 5884ee918e Add galera_data_dir variable
Control mysql datadir with variable. Decrease code dublication since path
is heavily used in different places. If path needs to be changed
overriding config won't be enough.

Change-Id: I6fcefe216236ffea60da5fee42aad47c6f7da133
2022-04-12 11:27:03 +00:00
Dmitriy Rabotyagov ebc0417919 Use separate tmp directory
During upgrades or cluster repairments, temporary directories are created
inside /var/lib/mysql and treated as databases. This results in errors
during mysqlcheck like:

`Got error: 1102: Incorrect database name '#mysql50#tmp.stLr46FBlt'`

Path outside of datadir is not choosen since it could be separate mount
point and it's important for replication
to survive reboots.

Change-Id: Ia110dd9ed09b04f6bb7a0a3adf5a808966558507
2022-04-11 15:24:29 +00:00
Dmitriy Rabotyagov 802fe752d9 Change location of ipaddr filter
ipaddr filter has been moved from netcommon to utils collection [1]

Based on that we must add that collection to requirements.

[1] db4920ebf6

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/831525/10
Change-Id: I27b3914806a6218114ba0a196b0cc1f145be7023
2022-03-11 09:20:13 +00:00
Zuul ff5ef389a4 Merge "Convert xinetd clustercheck to systemd socket service" 2022-02-09 00:44:07 +00:00
Jonathan Rosser 41553dfa7a Convert xinetd clustercheck to systemd socket service
Depends-On: https://review.opendev.org/c/openstack/ansible-role-systemd_service/+/826602
Change-Id: I76e7498b1676a2b4c550fda049f332aa209ce53d
2022-02-01 08:27:12 +00:00
Andrew Bonney da6bdafd65 Listen on an additional port for monitoring/diagnostic purposes
If the Galera cluster hits its configured max_connections value
then only the super-users can still connect for debug purposes.
As the monitoring user cannot connect, this can cause a cascading
failure as HAProxy marks the instance as unreachable.

This configuration adds an extra listening port with a limited
number of connections to allow the monitoring user to connect at
all times.

Change-Id: I57187bab2ee35521c275f0f0b99c1ca8fd1830ad
2022-01-31 10:01:58 +00:00
Dmitriy Rabotyagov 1aff51416e Allow galera_address to be FQDN
We explicitly allow setting galera_address as FQDN and define it equal
to internal_lb_vip_address by default [1]

Currently if it's set to FQDN certificate generation fails, as we
provide it always as IP.

[1] https://opendev.org/openstack/openstack-ansible/src/branch/master/inventory/group_vars/all/infra.yml#L35

Change-Id: I7b470df7ff45c884c8058f75a7f6a73a41f34911
2021-12-28 17:57:28 +02:00
Damian Dabrowski b79574382b Inherit default galera_wait_timeout value from openstack_db_connection_recycle_time
Set a new default value for ``galera_wait_timeout`` which is inherited from global ``openstack_db_connection_recycle_time``.

These variables are directly related, it would cause errors when ``galera_wait_timeout`` is lower than ``openstack_db_connection_recycle_time``.
From the other hand, I don't see any reason for ``galera_wait_timeout`` to be higher than ``openstack_db_connection_recycle_time`` in most cases.

Change-Id: I9450912ec7960a8ab713517532164cab52628b30
2021-12-02 12:15:06 +01:00
Dmitriy Rabotyagov d9a21b1433 Update mariadb to 10.6.5
Previous mariadb version 10.6.4 was troublesome. We hope that
issues were fixed in 10.6.5 but we need to be cautious with it.

Change-Id: I2c85bfa5976752b297df337aa7726f934ae5db90
2021-11-24 11:24:37 +00:00
Dmitriy Rabotyagov 6bc6929d09 Use ansible-role-pki to generate SSL certificates
Supports two scenarios:

1) variables defined in defaults/main.yml are sufficient to create
a root/intermediate CA certificate for mariadb when this role
is used outside openstack-ansible.

2) when:

openstack_pki_dir
openstack_pki_setup_host
openstack_pki_authorities
openstack_pki_service_intermediate_cert_name

are defined, an external CA already created on the deploy host
with a previous run of ansible-role-pki will be used as the CA.

Server certificates for the galera instances are created from the
data in galera_pki_certificates in both situations

Depends-On: https://review.opendev.org/c/openstack/ansible-role-pki/+/807771
Change-Id: I72738e4f8bd2233dedbed4428baafd4436de84b5
2021-09-09 15:21:38 +00:00
Jonathan Rosser 4b66580dad Revert "Update galera to 10.6.4"
This reverts commit 88b6fd10f5.

Reason for revert: Upgrade seems to fail on Focal

Change-Id: Id0146f381378a1379292d1a5eca86bc3e4cd4e5c
2021-08-24 15:10:29 +00:00
Jonathan Rosser 88b6fd10f5 Update galera to 10.6.4
Also delete vars/debian-11.yml so that debian bullseye installs from the official repo
rather than using the distro packages.

Change-Id: I0e293583a8b4952740398177f5fb1ee5bb5197b4
2021-08-16 13:24:28 +03:00
Jonathan Rosser 2ad823eafd Update galera to 10.5.12
Also remove vars/debian-11.yml so that bullseye takes packages from the official mariadb repo
rather than using the distro provided package.

Change-Id: I084f63d071394022b4b2dd6ad1433e4036adc978
2021-08-12 09:58:13 +00:00
Dmitriy Rabotyagov 818c5a71b0 Replace systemd unit overrides with role
Instead of placing bunch of templates, we can use our systemd_role
that is capable of placing just overrides file, that will have same
functionality but also provide ability to easily add required data into
systemd overrides.

Change-Id: I7b3b0f4da047f82a49266ef57fba2fbaa24cebdc
2021-06-16 15:40:29 +03:00
Dmitriy Rabotyagov 4d4f18f8fa Include galera_devel into main
In order not to duplicate variables gathering code, we include
galera_devel_main inside main.yml alike with server and client
tasks.

Change-Id: I33e7484dda01a90ef6d9f27104f7efa3e48ee270
2021-05-12 22:13:54 +03:00
Zuul 99a5559f60 Merge "Bump MariaDB version to 10.5.9" 2021-04-21 10:58:41 +00:00
Sebastian Gumprich e91c8be449 add support for encryption
Closes-Bug: #1921861

Change-Id: I73e548ac208a96ddaa687a1b5fbb22cac20037d0
2021-04-20 06:42:28 +00:00
Jonathan Rosser 1db0ef2efb Bump MariaDB version to 10.5.9
We also workaround known mariadb bug which make upgrades from previous
version to fail because of changing privileges bits which ends up
in revoking some of the privileges from superusers.

Depends-On: https://review.opendev.org/775684
Depends-On: https://review.opendev.org/781305
Change-Id: Id28057c9b9043c9ef609f4ed6f40a8a21a2e6a8e
2021-04-19 14:35:25 +00:00
Georgina Shippey 84e9f96712 Update galera_wsrep_sst_auth_user to use galera_root_user
With the changes to the root user and creation of the admin user in:
https://review.opendev.org/c/openstack/openstack-ansible/+/775684/
galera_wsrep_sst_auth_user needs to use the overridden galera_root_user
as the password is no longer set on the root user.
Otherwise galera cannot sync and cluster properly as access is denied.

Change-Id: I8f03ee7a7a144fa901caf7b6c1ed041e09f2ffc0
2021-03-18 10:46:05 +00:00
Jonathan Rosser 374b64435e Use ansible_facts[] instead of fact variables
See https://github.com/ansible/ansible/issues/73654

Change-Id: I88dc5a3da8b8abe801eb533ec93cffdbeed7bd65
2021-02-25 12:26:58 +00:00
Georgina Shippey 8ce7da7a3c Bring db setup vars in line with other roles
Allows for galera_db_setup_host to be overridden if necessary for delegation.
Brings the format in line with the db_setup vars in other roles.

Change-Id: Ie2a802ebb8297bed03d74b3cf54907322b858896
2021-01-20 14:13:55 +00:00
Jonathan Rosser b0e4cb8953 Bump mariadb version to 10.5.8
Incorporate latest bug fixes in the 10.5 release

Change-Id: I4a4e958c98b67203774e0c8aa0d208aede0673c7
2020-12-16 12:31:09 +00:00
Georgina 0b853b1da7 Use mysql user instead of root
Using the mysql user is the safer option from a security point of
view. Also use a backups group with programmable GID to allow access
to read backups by other users.

Change-Id: Iff18c68f5662eae2dbbffa40ce9fb6f9cad7be72
2020-12-01 11:02:26 +00:00
Zuul 258470a89a Merge "Ability to take mariadb backups using mariabackup" 2020-11-11 18:40:54 +00:00
Georgina 9a8ee0293b Ability to take mariadb backups using mariabackup
This patch allows a user to specify a directory they would like their
database backups to be put into. A number of full backup copies will
be kept alongside their corresponding increments (if any).
Users can specify multiple systemd timer OnCalendar directives for taking
full back ups and incremental backups. Incremental backups are optional.

Depends-On: https://review.opendev.org/759146/
Change-Id: Id78151a23ec5fcc424bfba669673a4a2df83ef23
2020-11-09 12:49:23 +00:00
Jonathan Rosser 7075e72c65 Update galera to 10.5.6
This is the first stable release from the 10.5 series.

Depends-On: https://review.opendev.org/758399
Change-Id: I76438e6519eac09be7f9729de3cefb4130f72dea
2020-10-15 11:21:39 +00:00
Dmitriy Rabotyagov 3b44cf919c Fix default galera_wsrep_provider_options
Change-Id: I9b8b16c6947a2b795f765002765bb601dd7b618b
2020-06-26 11:52:41 +03:00