Commit Graph

224 Commits

Author SHA1 Message Date
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
Dmitriy Rabotyagov cef3aa94f6 Remove warn argument for command/shell
Since ansible-core 2.14 you can't use warn as module argument.

Change-Id: Id5ae73222a1109ad13b0b70ba3d02063d931ff90
2023-07-06 18:18:48 +02: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 670e88071b Define GPG key for repo
With update of GPG key that was made in [1] we broke upgrade path,
since new key is not being updated by gpg_key module and it results
with OK state despite new content it placed to GPG keyfile

With that patch we replace usage of gpg_key with defining gpgkey
option for yum_repository, which treats it way more properly and
fixes upgrade path as well as simplifying overall flow.

[1] https://review.opendev.org/c/openstack/openstack-ansible-galera_server/+/879150

Change-Id: Ie322e0e69c5e7b2acd55bc18cf23fed1fa8f4f17
2023-04-06 16:29:49 +02:00
Sebastian Gumprich 17ff99cedb fix indentation for condition
Change-Id: Ia6712c8847389d6f439c6b768c08a47af91bc3ae
2023-03-06 14:19:48 +01:00
Dmitriy Rabotyagov 8a8d29ea49 Allow maridbcheck socket to FreeBind
Once we've removed network.target from wanted targets for
mariadbcheck.socket, it started to fail to startup intermitently in LXC
deployments, since it was trying to bind on IP address that is not
brought up yet. At the same time we can't wait for IP being up, as
OVS while providing network, waits for socket.target as it needs
to have ovsdb started up, so waiting for network.target does
create circular dependency.

To avoid that we're allowing socket to bind on IP even when IP is not
UP yet. Other possible solution would be to bind on 0.0.0.0.

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/872896
Change-Id: Ia4cde2153813e68419d261cd94e3017523177142
Closes-Bug: #2003631
Related-Bug: #2002653
2023-02-09 22:20:23 +01:00
Dmitriy Rabotyagov bfe6dffee0 Do not forcefully restart socket
With state:restarted for socket it will be restarted on each playbook
run, even when it's not needed. Instead, we should restart socket
only when it's changed.

Depends-On: https://review.opendev.org/c/openstack/ansible-role-systemd_service/+/871526
Change-Id: Ia7d3d1cbfa3aea934d10262a8556952e58e82953
2023-01-23 19:17:39 +01:00
Zuul 1eb6f73fe6 Merge "Remove "warn" parameter from command module" 2023-01-18 10:19:13 +00:00
Jonathan Rosser d515ba7711 Remove "warn" parameter from command module
This is removed in ansible 2.14.

Change-Id: If48e13dc22d5fbe004444ba9ba74999512ff22c5
2023-01-13 10:25:37 +00:00
Dmitriy Rabotyagov a2ce91ebcb Prevent mariadbcheck.socket to wait for network.target
As of today bare metal scenarion does contain systemd ordering cycle [1]
due to mariadbcheck.socket waiting for network.target while being
part of that target. Removing that dependency solves the cycle.

[1] https://paste.openstack.org/show/bE9UlN6dK8awqZl3uwrQ/
Closes-Bug: #2002653

Change-Id: If4729eca992a0e647e2f15b3d77ad6300bbf9c12
2023-01-13 11:16:43 +01:00
Dmitriy Rabotyagov c6218267c6 Use policy_rc_d attribute instead of copy
Since ansible 2.8 it's possible to provide policy_rc_d attribute to the
apt module in order to avoid service restart on installation/upgrade

Change-Id: Ida1ce1b767497c792fbb7bcdb934ba5e282041b1
2022-09-26 13:28:32 +02:00
Erik Berg d37ba4a195 Remove redundant vars line
This line snuck in with I703079f9ba98ca4c0c825bd36746280d91dd4a5b
probably to bring it in line with other OSA roles, but should already
be covered by the distribution_major_version line above.

Change-Id: I829312656d805e972c45a984266b3bd9ce41ff75
2022-09-15 09:07:50 +02: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
Dmitriy Rabotyagov 72ffc6d565 Do not place debian.cnf when root user not touched
We used to overwrite /etc/mysql/debian.cnf file that is provided by
package when we were resetting root password for mariadb. That was
required as otherwise systemd couldn't manage service properly.
Now, when galera_root_user can be different then root, we don't need to
do this and can rely on defaults.

Change-Id: Ia8305121900d28aca28a80c6c9d6a664aec40214
Closes-Bug: #1979726
2022-06-24 10:46:19 +02:00
Dmitriy Rabotyagov c9da7d6975 Remove mention of haproxy-endpoints role
Keystone role was never migrated to usage of haproxy-endpoints role
and included task was used instead the whole time.
With that to reduce complexity and to have unified approach, all mention
of the role and handler are removed from the code.

Change-Id: I2a83e31a9de998cd10dd95fc0cffc1ad68061da5
2022-06-14 19:07:55 +02:00
Marc Gariepy 7b555f4119 Fix systemd and centos9.
* some package were missing on c9s
* fix systemd socket as it requires a list.

Change-Id: I9cf60ae7b16639a6bf06e050e284757b35dd0dce
2022-06-01 13:13:23 -04:00
Marc Gariepy 3e6a28272d Fix race on boot for mariadb-check socket
Change-Id: If6da4eb1f29549abd28f9e8abb9a850f86853c1f
2022-05-26 16:34:58 -04: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 45263ac621 Clean-up systemd overrides removal task
Once upgrade is done and release is branched, we can cleanup
task that was added for upgrade purposes only

Change-Id: Ibe1bc6f5cee30ab0682078dfe3ce5464336cf822
2022-03-10 16:50:35 +01:00
Damian Dabrowski 3c57409bdf Use unix socket while granting access for the backup service
/root/.my.cnf is not stored on galera container anymore, so it's not
possible to run mysql_user via TCP connection.
Unix socket should be used instead.

Change-Id: I71bc866aedaa6fba3cc86d2a2a99ed32f0727c54
2022-02-13 20:51:36 +01:00
Zuul ff5ef389a4 Merge "Convert xinetd clustercheck to systemd socket service" 2022-02-09 00:44:07 +00:00
Jonathan Rosser 349df7b50c Remove legacy cleanup tasks
These should have been removed in the Pike release.

Change-Id: I62fe8a2a828ef2f25608ac507e22b6d051365667
2022-02-01 03:30:06 -05: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
Zuul 18d8de22dc Merge "Refactor use of include_vars" 2022-01-12 15:22:40 +00:00
Jonathan Rosser 5f924870f6 Refactor use of include_vars
Use a first_found lookup instead of a with_first_found loop so that
the 'paths' parameter can be used.

This ensures that only vars from the role are included, and not vars
from a parent calling role. This can happen when a parent role has
a higher priority vars file available for inclusion than the role
it calls.

Change-Id: I703079f9ba98ca4c0c825bd36746280d91dd4a5b
2022-01-12 08:49:57 +00:00
Damian Dabrowski 5317155f17 Enable recursion in combine() filter
Ansible's combine() filter needs recursive=True parameter in order to recursively merge nested hashes.

https: //docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#combining-hashes-dictionaries
Change-Id: Id98cabad0d8288fedc1be10a93fb64de402f4cd0
2022-01-11 19:24:03 +01:00
Dmitriy Rabotyagov f3364da086 Do not verify certificate for local connects
We don't issue certififcate for localhost, and mysqlclient acts as
a localhost connection while connecting thorugh socket as well.
While issuing cert for localhost may lead to unpredictable results
we just avoid verifying certificate when connecting locally.

Change-Id: I556ae69c33ab9cc984d7c01868403be49faa0dbc
2021-12-08 15:32:33 +02:00
Dmitriy Rabotyagov 0830fe8bc5 Use config_template as a collection
Since we still use ceph-ansible that has their own implementation of
config_template module it's worth to use mentioned module as a collection
explicitly.

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/819814



Change-Id: I97990584dfe72bec3173595a3ba04f2651d9e7df
2021-11-30 15:17:10 +02:00
Dmitriy Rabotyagov c857503274 Fix mysql_upgrade possible race condition
On deb packages of MariaDB, mysql_upgrade is ran with debian-start
script as systemd post-run step. This means, that we don't really have
control when it's launched and we need to wait until process
is finished before proceeding with it's setup.
In the meanwhile redhat is packaged differently and mysql_upgrade
must be run manually.

Based on that we change ordering and verifying explicitly that
upgrade has finished.

Change-Id: Ib0f410cfcdcc416b58b03febab9c55dc7982de38
2021-11-24 11:10:06 +02: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
Damian Dabrowski 677dddf21a Improve support for tags
Previously we had defined some tags but there wasn't any way to make use of them(like galera_server-backups), this change improves tag support

Change-Id: Ib8fd1aca7aa85d7fe17376ca7f6629b1db0dac88
2021-06-30 16:23:02 +02: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
Zuul 60de69f0ec Merge "Add support for Debian Bullseye" 2021-05-18 16:07:42 +00:00
Jonathan Rosser c2e17ae47f Add support for Debian Bullseye
There is no offical MariaDB build for bullseye so we must use
the version from the operating system repo.

Change-Id: I46f9d73ac27928edf4236fd797afde6e5ea9427e
2021-05-13 16:06:11 +00: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
Dmitriy Rabotyagov f6bd5c9e53 Add galera devel packages installation
There might be cases, where devel packages installation might be required
Since it's pretty specific usecases, we don't inlcude it into
tasks/main.yml and intend to use tasks_from during rule include.

Needed-By: https://review.opendev.org/c/openstack/openstack-ansible-os_adjutant/+/777607
Change-Id: I79be2197aa1859ece853a197ec685e4bc460c133
2021-05-05 14:22:16 +03:00
Sebastian Gumprich e91c8be449 add support for encryption
Closes-Bug: #1921861

Change-Id: I73e548ac208a96ddaa687a1b5fbb22cac20037d0
2021-04-20 06:42:28 +00:00
Jonathan Rosser 49b7d9488b Remove references to unsupported operating systems
All references to Gentoo, SUSE, Debian stretch and Centos-7  are removed.
Conditional tasks, ternary operators and variables are simplified where possible
OS specific variables files are generalised where possible

Change-Id: I50bb0f00658e292f39269c3980109e56319a00ca
2021-03-16 09:23:50 +00:00
Zuul 1484301a81 Merge "Configure my.cnf for server when galera_root_user is not root" 2021-03-03 03:06:58 +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
Dmitriy Rabotyagov 931f3c74a7 Configure my.cnf for server when galera_root_user is not root
When galera_root_user is set to non-root user current behaviour is
to place my.cnf file as a part of the server setup, however
this non-root user is not created yet. User creation is handled
after server proper bootstrap and handlers flush. Having my.cnf
file in place makes bootstrap script fail, since it tries to use
credentials from this file which are not valid yet.

Instead we allow client part of the role to configure my.cnf
on metal deployments and set galera_root_user credentials
in it once user is properly created

Change-Id: I88edfe87fd134bdbcf199a48443fc063740a8604
2021-02-17 20:07:08 +02:00