30 Commits

Author SHA1 Message Date
Dmitriy Rabotyagov
3add3ee734 Auto-fix yaml rules
In order to reduce divergance with ansible-lint rules, we apply
auto-fixing of violations.

In current patch we replace all kind of truthy variables with
`true` or `false` values to align with recommendations along with
alignment of used quotes.

Change-Id: I5f7e27158a4bf8f4bf14d4a5e32cc9204441da02
2025-02-12 08:21:19 +01:00
Dmitriy Rabotyagov
77995baef7 Add molecule testing for the role
Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/939771
Change-Id: I5e11a0309c3ba4a35f4fafb5927799d7d7b449f0
2025-01-22 19:14:21 +01:00
Dmitriy Rabotyagov
7b57dd9b83 Remove xinetd clean-up tasks
Change-Id: I77cc32f49864f7caaad52150cc6684a488caa128
2024-07-02 15:27:27 +00: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
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
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
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
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
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
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
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
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
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
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
Jonathan Rosser
3d07a246d5 Install xinetd clustercheck after mariadb is installed and setup
The configuration of mariadb is done mostly in handlers and previously
the code would install the xinetd clustercheck script before calling
flush_handlers to bootstrap and initialise the database. This leads
to a situation where the clustercheck may be attempting to interact
with the database during bootstrapping and before the monitoring user
has been created.

This change moves the setup tasks for the clustercheck service until
after the database has been bootstrapped and the users created. This
means that any healthchecks from the loadbalancer will not be seen by
the database until after the setup is completed during the initial
deployment.

Change-Id: Ibd55306a5c17bc0a4333e43725f1637420a2c9d9
2021-02-10 21:33:14 +00:00
Dmitriy Rabotyagov
9e5497aa0a Fix Mariadb 10.3 -> 10.4 upgrade path
After bumping version to mariadb 10.4 upgrade path has been broken
as service name and packages have new naming patterns
for a while.

We also temporary disable ubuntu upgrade jobs to be able
to merge patch.

Change-Id: I3696b3131de424a4b30ff016da714aef22af4e59
2020-06-13 17:09:52 +00:00
Dmitriy Rabotyagov
0a36313fa0 Bump MariaDB version to 10.4
Patch aims to use next stable release of MariaDB

Remove no_log from functional tests, the only credentials used here
are for the purposes of the test and debug output is valuable.

Change-Id: Ic4cdc26ddf1cb0591f0a2218355b7cca7af0b0fb
2020-05-28 12:56:36 +03:00
Jonathan Rosser
49b95ebcb7 Combine galera client role into galera_server
Depends-On: https://review.opendev.org/725902
Depends-On: https://review.opendev.org/728434
Change-Id: I02dc06d61006bb71a417a1470343e9c9c77d7935
2020-05-22 15:13:20 +03:00