Commit graph

297 commits

Author SHA1 Message Date
Andrew Klychkov
b26235b7d7
Release 3.13.0 commit (#705) 2025-03-21 07:02:43 +01:00
Keeper-of-the-Keys
45a29408ad
User locking (#702)
* function to check if a user is locked already

Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es.rosenberg+github@gmail.com>

* Add the location and logic of where I think user locking would happen.

Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es.rosenberg+github@gmail.com>

* Fix missing parameters for execute()

Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es.rosenberg+github@gmail.com>

* Add the locked attribute

Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es.rosenberg+github@gmail.com>

* Initial user locking integration tests

Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es.rosenberg+github@gmail.com>

* Add attribute documentation

Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es.rosenberg+github@gmail.com>

* More descriptive names in the integration tests

Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es.rosenberg+github@gmail.com>

* - Changes requested/suggested by @Andersson007
- Example usage
- Changelog fragment

Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es.rosenberg+github@gmail.com>

* Fix user_is_locked and remove host_all option.

Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es.rosenberg+github@gmail.com>

* Fix host of user (was % should have been localhost after deleting `host:` earlier)

Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es.rosenberg+github@gmail.com>

* Switch locked to named instead of positional.

Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es.rosenberg+github@gmail.com>

* Add check_mode support.

Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es.rosenberg+github@gmail.com>

* Add check_mode: true test cases

Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es.rosenberg+github@gmail.com>

* Fix names that included `check_mode: true`

Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es.rosenberg+github@gmail.com>

* Add idempotence checks

Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es.rosenberg+github@gmail.com>

* Switch calls to user_mod with sequences of None positional arguments to full named arguments

Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es.rosenberg+github@gmail.com>

* locked check should not run for roles.

Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es.rosenberg+github@gmail.com>

* check_mode is set at the task level and not the module level

Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es.rosenberg+github@gmail.com>

* Add user locking to info module and test.

Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es.rosenberg+github@gmail.com>

* Handle DictCursor

Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es.rosenberg+github@gmail.com>


* Add check_mode feedback

Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es.rosenberg+github@gmail.com>


* Add another builtin account to the exclusion list

Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es.rosenberg+github@gmail.com>

* Initial switch to default=None for locked, will need to add a test for it.

Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es.rosenberg+github@gmail.com>

* Add check that missing locked argument does not unlock a user

Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es.rosenberg+github@gmail.com>
---------

Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es.rosenberg+github@gmail.com>
2025-03-19 14:40:59 +01:00
Laurent Indermühle
dd7e297d50
Add support for MariaDB 11.4 (#703)
* fix missing symlink to mysql binaries for MariaDB 11+

* update tested version of MariaDB 11.4 instead of 10.5

* add changelog fragment

* [CI] add way to trigger workflow manually

Useful in the case we don't modifiy any files in the paths: sections of the push event.

* add version check for mariadb < 10.4.6 without mariadb* binaries

* Use same concatenation method between functions to avoid future confusion

I didn't notice that db_dump and db_import were different, thus I introduced a bug with the initialization of the variable cmd. This commit fixes that.
2025-03-10 18:55:42 +01:00
Andrew Klychkov
e9845b0a1c
Release 3.12.0 commit (#698) 2025-01-17 10:11:27 +01:00
Andrew Klychkov
960ac32adf
mysql_query: returns execution_time_ms list containing execution time per query (#697)
* mysql_query: returns execution_time_ms list containing execution time per query

* Update changelogs/fragments/0-mysql_query-returns-exec-time-ms.yml

Co-authored-by: Laurent Indermühle <laurent.indermuehle@pm.me>
2025-01-16 15:49:53 +01:00
Sergio
a45a0d006d
mysql_db: added zstd support (#696) 2025-01-16 09:35:04 +01:00
Andrew Klychkov
022ed60906
Fix linting issues (#693) 2024-12-13 09:21:06 +01:00
Laurent Indermuehle
3d3f115574
Add next expected version 2024-11-19 10:56:37 +01:00
Laurent Indermühle
e437d562c1
Release 3.11.0 commit (#692) 2024-11-19 10:51:58 +01:00
Laurent Indermühle
9057637844
mysql_info - add table count to the databases returned values (#691)
* Add tables count per database
* Add integrations tests
* Deduplicate tests between main and new task file
2024-11-19 08:51:03 +01:00
Laurent Indermühle
d613fa1993
Fix wrong documentation assertion (#690) 2024-11-18 15:44:39 +01:00
Laurent Indermühle
7d787eb238
Add contributors from last 10 PR pages (#688)
I've applied a sort on the whole file. This Patch is hard to read,
sorry. I've remove nobody! Only move!
2024-11-07 10:37:10 +01:00
Soledad208
ebb37ae7a3
sql_mode can be set in session, therefore we should look for ANSI_QUOTES in session variable instead of global variable (#677)
* issue-671: get ASNI_QUOTES from session sql_mode instead of GLOBAL sql_mode
2024-11-07 09:56:31 +01:00
Andrew Klychkov
90bd0b0a75
Update contributor's email (#684) 2024-10-24 10:57:36 +02:00
JS
93cd1850d9
Update mysql_user.py - table/privilege spacing update (#687)
* Update mysql_user.py - table/privilege spacing update

Add note for no spacing between the table and the privilege as this will make the task not idempotent in check mode but still make it idempotent when in normal mode.

* Update plugins/modules/mysql_user.py

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

---------

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2024-10-23 10:31:40 +02:00
Andrew Klychkov
a5afa1a375
CI: add stable-2.18, fix README (#681)
* CI: add stable-2.18, fix README

* Update .github/workflows/ansible-test-plugins.yml

Co-authored-by: Laurent Indermühle <laurent.indermuehle@pm.me>

* Update .github/workflows/ansible-test-plugins.yml

Co-authored-by: Laurent Indermühle <laurent.indermuehle@pm.me>

* Update .github/workflows/ansible-test-plugins.yml

Co-authored-by: Laurent Indermühle <laurent.indermuehle@pm.me>

* Update README.md

Co-authored-by: Laurent Indermühle <laurent.indermuehle@pm.me>

---------

Co-authored-by: Laurent Indermühle <laurent.indermuehle@pm.me>
2024-09-26 14:31:08 +02:00
Maxwell G
28bf7093be
changelogs: categorize deprecations under deprecated_features (#679)
These should be put under deprecated_features so they show up properly
in the generated changelog.
2024-09-11 14:35:02 +02:00
Andrew Klychkov
a75d71a7ff
Release 3.10.3 commit (#678) 2024-09-09 15:05:25 +02:00
hubiongithub
eec6e7091f
Update user.py (#676)
* Update user.py

Added correct syntax to ed25519 password plugin.
on create user
on update user
This only accepts cleartext passwords (PASSWORD(%s)) not pregenerated ed25519 hashes.

* Update plugins/module_utils/user.py

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Update plugins/module_utils/user.py

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Update plugins/module_utils/user.py

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Update plugins/module_utils/user.py

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Update plugins/module_utils/user.py

* Update plugins/module_utils/user.py

---------

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2024-09-09 15:01:26 +02:00
Andrew Klychkov
7188bea0c8
Release 3.10.2 commit (#675) 2024-09-06 08:21:45 +02:00
Andrew Klychkov
3425fdb839
mysql_user: add correct ed25519 plugin handling when creating a user (#674) 2024-09-05 12:19:33 +02:00
Andrew Klychkov
2db131f8c0
Release 3.10.1 commit (#673) 2024-09-04 07:19:59 +02:00
Andrew Klychkov
59c26211ca
mysql_user: deprecate alias user for name argument (#670)
* mysql_user: deprecate alias user for name argument
* Fix module and tests
2024-09-02 18:07:11 +02:00
Fran
0de9685cf1
Fix user plugin changes in check mode (#596)
* Fix user plugin changes in check mode

* Add auth plugin tests

* Undo local changes

* Improve task names

* Fix query

* Changes

* Add check

* Add check

* Add check

* Add one more check

* Add one more check

* Fix typo

* Change parameter

* Testing

* Remove tests

* Add tests

* Test first stteps

* Readd tests

* Test without check mode

* Test with check mode

* Test with check mode

* Testing

* Testing

* Add missing tests

* Changes for ansible-lint complaints

* Fix condition

* Update changelogs/fragments/596-fix-check-changes.yaml

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* refactor

* Add more tests

* Fix newpass var

* Remove extra test

---------

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2024-08-30 11:15:16 +02:00
Andrew Klychkov
87be61ccf3
CI: Fix sanity errors (#668) 2024-08-29 08:47:48 +02:00
Andrew Klychkov
37a718c66f
Release 3.10.0 commit (#667) 2024-08-22 10:45:53 +02:00
Andrew Klychkov
a9f9806728
README: Add Communication section with Forum information (#665) 2024-08-19 10:41:13 +02:00
Laurent Indermühle
cd9f4fcf57
Fix deprecated options from MySQL 8.2 (#662)
* Fix show master status for MySQL 8.2+

* Fix mysqldump option form --master-data to --source-data

* Fix incompatibility between mysqldump 8.0 and MySQL 8.4

Installing the same version between the client and the server makes
sense anyway. The incompatibility arise when you use mysqldump with
--source-data. The the tool tries to perform a SHOW MASTER STATUS which
is deprecated in MySQL 8.2+.

* Fix missing condition

* Fix unit tests

* Add a query resolver depending on implementation and version

* Sanity

* Fix SHOW REPLICA STATUS queries

* Fix mariadb's SHOW REPLICA HOSTS query

* Fix CHANGE MASTER for MySQL 8.0.23+

* Fix integration test for CHANGE MASTER

* Fix integration test for CHANGE MASTER

* Fix replication queries for MySQL 8.0.23+ and 8.4+

* Revert file edited by mistake

* Enhance tests format
2024-08-05 08:55:18 +02:00
Laurent Indermühle
c503dc5b6b
[CI] Add 2024 versions to tests (#660)
* Enable mysql_native_password for MySQL 8.2+
* Fix connection to MySQL 8 since Ubuntu 20.04 update
* Cut mysqlclient form the documentation
* Cut tests for Python 3.12 not supported by ansible-test
* Upgrade integration controller to ubuntu2204 by removing python

ansible-test uses python 3.10 if we specify ubuntu2204. Thus we lose the
ability to chose specific version of python to test. But integrations
tests are optional for a collection. And we don't catch a issue with
Python that often (ever ? I don't recall seen one).

This allow us to test MySQL 8.4, so it's a win.

* Cut tests for EoL MariaDB 10.4
* Reduce number of test in the matrix
* Cut support for intermediate LTS
* Fix python command not found with ansible-devel and add the debug

This is puzzling me. Why when using ansible devel the python command
changes? I know ansible-test install python after starting ubuntu22.04
so the way python is install must changes.

* Disable retry-on-error

When reading log we tend to look at the bottom, but doing so we find
often a idempotent error that are nothing to do with the first error.
Disabling this can greatly speedup tests and makes logs more readable.

Plus, now GHA jumps automatically at the latest error message. So with
this modification, we will always jump to the latest real error message.

* Enhance jobs title readability

We can't expand the left column on GHA, so the shorter, the better.
Use Ⓐ instead of Ansible.
2024-07-19 11:04:13 +02:00
Andrew Klychkov
83ed4af4e1
Deprecate mysqlclient/MySQLdb connector support (#655)
* Deprecate mysqlclient/MySQLdb connector support

* Update README

* Put in README that mysqlclient is deprecated
2024-07-09 08:20:47 +02:00
Andrew Klychkov
4912f1a41b
mysql_variables: fix boolean value handling (#653)
* mysql_variables: fix boolean value handling

* fix

* Fix tests

* Fix tests

* Fix

* Fix

* Fix

* Fix comment
2024-06-28 11:34:59 +02:00
Laurent Indermühle
33e8754c4e
Fix mysql_user on_new_username IndexError (#642)
* fix tuple indexerror when no accounts are found

* Fix tests for update_password not executed

* Add test for case where existing user have different password

* lint to prevent warning about jinja templating in when clause

* Refactor get_existing_authentication to return a list of all row found

Previously we were returning only the first row found. We need to be
able to see if there is a difference in the existing passwords.

* Refactor host option to be optional

This make it possible to use the same method from mysql_user to help
update_password retrieve existing password for all account with the same
username independently of their hostname. And from mysql_info to get
the password of a specif user using WHERE user = '' AND host = ''

* Add change log fragment

* Add link to the PR in the change log

* lint for ansible devel

* Fix templating type error could not cconvert to bool with ansible devel

* Revert changes made for ansible-devel that broke tests for Ansible 2.15

* Revert changes made for ansible-devel that broke tests

* Cut unnecessary set, uniqueness is ensured by the group_by in the query

* Cut auth plugin from returned values when multiple existing auths exists

Discussed here:
https://github.com/ansible-collections/community.mysql/pull/642/files#r1649720519

* fix convertion of list(dict) to list(tuple)

* Fix test for empty password on MySQL 8+
2024-06-27 22:12:01 +02:00
Laurent Indermühle
1922e7154e
[CI] Remove ansible-test custom containers (#650)
* Cut tests containers

* Cut unused flatten versions

* Fix installation of mysqlclient on Ubuntu

* Cut unused variables

* Fix package missing on Unbuntu 22.04

* Fix variable templating

* Fix test for ansible 2.17 and do remove the ignore_errors

ignore_errors is bad because it makes searching for real errors
difficult.
2024-06-24 09:36:32 +02:00
Andrew Klychkov
aafe658a85
Update README.md (#648) 2024-06-19 10:20:34 +02:00
Andrew Klychkov
f266ba59c9
mysql_info: add server_engine return value (#649)
* mysql_info: add server_engine return value

* Incorporate feedback
2024-06-19 10:17:02 +02:00
Matthieu Bourgain
0bc3e3d848
Add salt parameter to hash generation for sha256 plugins (#631)
* add salt parameter to hash generation for sha256 plugin
* technomax review modification
* no general user test for salt
2024-06-11 17:23:05 +02:00
Laurent Indermühle
50e7413b88
Fix hashed passwords being returned by get_existing_authentication() via the plugin_auth_string variable instead of plugin_hash_string (#629)
* fix returned variable from plugin_auth_string to plugin_hash_string
* Refactor to keep plugin_auth_string in addition to plugin_hash_string
* Add breaking_changes to the changelog
2024-06-06 13:05:31 +02:00
Robert Silén
6c4dca4bce
mention MariaDB (#640)
* mention MariaDB

* mention MariaDB in descriptions and notes

* nits

* chmod -x
2024-05-31 09:14:43 +02:00
Dennis Felipe Urtubia
47610347ba
Adds support for show binary log status statement (#638)
* feat: adds support for show binary log status statement

* feat: adds support for mariadb show binlog status statement
2024-05-30 17:10:36 +02:00
Dennis Felipe Urtubia
a80b805619
Adds support for CHANGE REPLICATION SOURCE TO statement (#636)
* feat: adds support for 'change replication source to' statement
2024-05-21 20:58:05 +02:00
Laurent Indermühle
6ce2f49f96
Improve get replica/primary status (#634)
* Fix case where a failed fetchone() still return a dict

* Fix test for MariaDB

* fix case where  a failed fetchone() still return a dict for primary

* Add changelog fragment
2024-05-02 10:26:04 +02:00
Laurent Indermühle
47710cfb93
Enhance support of tls_requires in mysql_user and mysql_info (#628)
* fix option name

* Add tests for users using SSL

* Rewrite get_tls_requires using mysql.user table

* Add tls_requires to users_info filter

* add more consistant test users

* Add tls tests users in cleanup task

* Fix tls_requires data structure inconsistencies between modules

* Refactor user implementation to host get_tls_requires

* fix MySQL tls_requires not removed from user passed as empty

* Fix wrong variable used to return a hashed password

* Fix sanity

* fix unit tests

* Add changelog fragment

* Add PR URI to the changelog

* Add more precise change log

* fix documentation using wrong variable as an example

* Document example returned value `tls_requires` from users_info filter

* Revert changes that will be in a separate PR

* Fix sanity
2024-04-16 10:52:24 +02:00
Laurent Indermühle
0618ff6c41
Fix sanity tests for ansible-core 2.18 (#627) 2024-04-12 09:00:43 +02:00
Laurent Indermühle
f105fd9a95
Add tests for Ansible core 2.17 (devel is 2.18 today) and bump tests dependencies (#623)
* Add tests for Ansible core 2.17 (devel is 2.18 today)

* Drop tests for Ansible core 2.14 and add 2.17

* Cut duplicate exclude

* Add back python 3.8 and 3.9 for stable2.15

* Bump action to prevent deprecation warnings

* Cut python 3.9 for devel in roles tests

* Attempt to fix GHA line folding

* fix typo

* Bump ubuntu

Latest ansible-test doesn't work with old ubuntu. See here for more
info: https://github.com/ansible-collections/collection_template/blob/main/.github/workflows/ansible-test.yml#L83-L91

* fix docker_image var assignation

* fix yamllint false positive

* Attempt to fix docker_image_multiline assignation

* Fix empty var due to scope of each command

* Attempt to fix docker_image assignation

* fix error "vars should be dict"

* Document URL of the repository for the action ansible-test-gh-action

* Disable role tests

* Document ansible-core version tested

* Cut ansible-core 2.14 from testing documentation
2024-04-11 10:46:43 +02:00
Andrew Klychkov
bfe2fdc3ff
mysql_user: fix ed25512 plugin handling (#619) 2024-03-14 07:19:39 +01:00
Andrew Klychkov
c99c19a489
README.md: update Communication guide (#617) 2024-02-27 10:27:19 +01:00
Andrew Klychkov
52a11d7235
Release 3.9.0 commit (#616) 2024-02-22 10:53:01 +01:00
tompal3
40af258d86
password_expire support for mysql_user (#598)
* initial commit for password_expire support

* sanity check and default values

* add one more if block for version check

* some changes and integration tests

* docs and sanity and integration test fix

* make integration tests work

* make integration tests work

* fix unneeded commits

* fix verify as well

* Update plugins/modules/mysql_user.py

Co-authored-by: Laurent Indermühle <laurent.indermuehle@pm.me>

* Update tests/integration/targets/test_mysql_user/tasks/test_password_expire.yml

Co-authored-by: Laurent Indermühle <laurent.indermuehle@pm.me>

* Apply suggestions from code review

Co-authored-by: Laurent Indermühle <laurent.indermuehle@pm.me>

* Update plugins/modules/mysql_user.py

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Update plugins/modules/mysql_user.py

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Update plugins/modules/mysql_user.py

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Update plugins/modules/mysql_user.py

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Update plugins/module_utils/user.py

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Update plugins/module_utils/user.py

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Update plugins/module_utils/user.py

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* typo and no_log remove for password_expire* vars

* add change log fragment

* move one if statement to module initialiazation

* fix merge conflicts

* fix order

* some fixes

* set no_log to true for password word containing keys

* fix sanity error

* Update changelogs/fragments/598-password_expire-support-for-mysql_user.yml

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

---------

Co-authored-by: Laurent Indermühle <laurent.indermuehle@pm.me>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2024-02-22 10:31:01 +01:00
Andrew Klychkov
21fe52d8f1
CONTRIBUTING.md: add a detailed guide (#615) 2024-02-22 10:19:08 +01:00
Andrew Klychkov
32718ca295
Update MAINTAINERS file (#612) 2024-01-25 07:55:51 +01:00