Commit graph

181 commits

Author SHA1 Message Date
Laurent Indermühle
c4e90f087d
Update galaxy.yml to the next expected version (#415) 2022-08-03 11:20:22 +02:00
Laurent Indermühle
af73fa0d76
Release 3.4.0 commit (#414)
* Changelog: Fix module name

* Release 3.4.0 commit
2022-08-03 11:03:17 +02:00
Andrew Klychkov
1776702b9d
Announce pipefail default change in community.mysql 4.0.0 (#408) 2022-06-30 11:38:21 +02:00
Laurent Indermühle
5108ca5e66
Fix mysqldump ignoring errors (#403)
* Add schema and tables for the tests

* Add tests for full dump with and without compression

* Add test for distinct dump with and without compression

* Fix sh not seeing errors for command before the pipe

sh is missing the pipefail flag. We must use bash for this.

* Add cleanup to prevent the following tests from failing

* Fix fqcn in module_defaults

* Add changelog fragment

* Add check to the error message to ensure we captured the right one

* Add option to activate the fix on systems with bash

* Fix errors when data schema is already absent

* Update changelogs/fragments/fix-256-mysql_dump-errors.yml

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

* Add markup for commands in the documentation string

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

* Add markup and next release version in the documentation string

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

* Fix missing dependency for MySQL 8

* Add pipefail to tests of uncompressed dumps to enure it still works

* Fix "bash command not found" if pipefail is used for uncompressed dump

* Fix sanity pep8

* Document example of dump with pipefail

* Add dedpulication to command construct

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

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2022-06-30 06:54:26 +02:00
Andrew Klychkov
6f87620d9b
README: update MariaDB versions we test against (#404) 2022-06-24 14:32:32 +02:00
Andrew Klychkov
b62a59cf5a
Update mariadb to 10.6.8 in test matrix (#370)
* Update mariadb to 10.6.8 in test matrix

* try 10.8.3

* change tarball path

* Change tarball name

* Add mariadb 10.8

* Fix

* Fix

* Fix
2022-06-24 13:50:19 +02:00
Chris Croome
0df46e0e67
Note added regarding the default config file, ~/.my.cnf (#400)
* Note added for https://github.com/ansible-collections/community.mysql/issues/394

* Update config file notes as discussed

* Update plugins/doc_fragments/mysql.py

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

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2022-06-16 15:17:45 +02:00
Andrew Klychkov
04aa13f6d6
mysql_replication: set MASTER_SSL=0 when primary_ssl is set to no (#397)
* mysql_replication: set MASTER_SSL=0 when primary_ssl is set to no

* Improve doc
2022-06-13 08:13:58 +02:00
Andrew Klychkov
8e79690a02
mysql_db: add chdir argument (#396) 2022-06-13 08:11:18 +02:00
Andrew Klychkov
2a3f8f6506
Update licensing information (#390) 2022-06-03 11:47:03 +02:00
Andrew Klychkov
482a0d8ee9
Release 3.3.0 commit (#389) 2022-06-02 08:23:25 +02:00
Maciej
2e9d50f274
Changed += to append because cmd is a list (#377)
Using += on a list cause some problems druing creation of mysql command:
/usr/bin/mysql   - - u s e r = r o o t   - - p a s s w o r d = ' ' --socket=/run/mysqld/mysqld.sock
2022-05-31 17:44:14 +02:00
betanummeric
ed3935abec
mysql_user: add "update_password: on_new_username" argument, "password_changed" result field (#365)
* mysql_user: add value 'on_new_username' to argument 'update_password'

* mysql_user: return "password_changed" boolean (true if the user got a new password)

* mysql_user: optimize queries for existing passwords

* mysql_user: add integration tests for update_password argument

* mysql_user: add description for "update_password: on_new_username" argument

* add changelog fragment

* formatting (PEP8)

* Update changelogs/fragments/365-mysql_user-add-on_new_username-and-password_changed.yml

Co-authored-by: Benjamin MALYNOVYTCH <bmalynovytch@users.noreply.github.com>

* Update changelogs/fragments/365-mysql_user-add-on_new_username-and-password_changed.yml

Co-authored-by: Benjamin MALYNOVYTCH <bmalynovytch@users.noreply.github.com>

* Update plugins/modules/mysql_user.py

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

* Update changelogs/fragments/365-mysql_user-add-on_new_username-and-password_changed.yml

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

* Update changelogs/fragments/365-mysql_user-add-on_new_username-and-password_changed.yml

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

Co-authored-by: Felix Hamme <felix.hamme@ionos.com>
Co-authored-by: Benjamin MALYNOVYTCH <bmalynovytch@users.noreply.github.com>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2022-05-31 16:00:24 +02:00
hubiongithub
51a38840d9
mysql_user: prevent password getting set for existing users on on_cre… (#342)
* mysql_user: prevent password getting set for existing users on on_create when plugin is used

* added changelog fragment

* format fix

* added substract_privs, to t list of arguments

* clarify the documetation

* additional documentation to password,plugin,plugin_hash_string,plugin_auth_string options, format fix on changelog

* 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>

* linting

* linting

* linting

* linting

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2022-05-31 07:40:32 +02:00
betanummeric
05eccd9a1d
mysql_role: add examples for "members_must_exist" argument (#376)
* mysql_role: add examples for "members_must_exist" argument

* mysql_role: fix syntax in example

* Update plugins/modules/mysql_role.py

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

* Update plugins/modules/mysql_role.py

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

Co-authored-by: Felix Hamme <felix.hamme@ionos.com>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2022-05-30 09:59:20 +02:00
betanummeric
bf5086d19d
mysql_role: add argument "members_must_exist" (#369)
* mysql_role: add argument "members_must_exist" (boolean, default true)

The assertion that the users supplied in the "members" argument exist is only executed when the new argument "members_must_exist" is true, to allow opt-out.

* mysql_role: add integration tests for argument members_must_exist

* add changelog fragment

* mysql_role: fix behavior of members_must_exist argument

* Update plugins/modules/mysql_role.py

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

* Update changelogs/fragments/369_mysql_role-add-members_must_exist.yml

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

Co-authored-by: Felix Hamme <felix.hamme@ionos.com>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2022-05-27 12:11:17 +02:00
Andrew Klychkov
647461010d
mysql_query: fix false change reports when IF NOT EXISTS clause is used (#322)
* mysql_query: fix false change reports when IF NOT EXISTS clause is used

* Fix

* Fix doc, add fragment

* Improve doc
2022-05-25 16:19:31 +02:00
betanummeric
ceda7662d0
mysql_role: don't add members to a role when creating the role and "detach_members: true" is set (#367)
* mysql_role: don't add members to a role when creating the role and "detach_members: true" is set, add integration test

* add changelog fragment

* mysql_role: add author betanummeric

* Update changelogs/fragments/367-mysql_role-fix-deatch-members.yml

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

Co-authored-by: Felix Hamme <felix.hamme@ionos.com>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2022-05-25 11:47:39 +02:00
betanummeric
07a72865f7
mysql_role: fix and simplify role member detection (#368)
* mysql_role: fix and simplify role membership detection

* add changelog fragment

* Update changelogs/fragments/368-mysql_role-fix-member-detection.yml

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

Co-authored-by: Felix Hamme <felix.hamme@ionos.com>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2022-05-25 10:16:50 +02:00
Per Lundberg
c489cf1a37
Update CHANGELOG.rst (#364)
Fix broken link
2022-05-18 12:52:05 +02:00
Andrew Klychkov
cc950cb53a
Release 3.2.1 commit (#363) 2022-05-17 12:18:41 +02:00
Felix Fontein
b2e476cb1a
Add PSF-license.txt file (#356)
* Add PSF-license.txt file.

* Update with actual CPython 3.9.5 license.
2022-05-16 09:41:48 +02:00
Andrew Klychkov
f62d708bcf
Release 3.2.0 commit (#355) 2022-05-13 09:16:24 +02:00
Andrew Klychkov
f57ed38beb
Move CHANGELOG.rst at top level (#349) 2022-05-12 11:42:30 +02:00
Andrew Klychkov
eff87f952b
Drop support for Ansible 2.9 and ansible-base 2.10 (#343)
* Drop support for Ansible 2.9 and ansible-base 2.10

* Improve README
2022-05-12 10:50:26 +02:00
Andrew Klychkov
8d114c7e39
mysql_user: fix parsing privs when a user has roles assigned to it (#341)
* mysql_user: fix parsing errors when a user has roles assigned

* Add a changelog fragment

* Fix a typo

* Fix CI
2022-05-12 09:36:21 +02:00
betanummeric
ba4fea67b1
mysql_user, mysql_role: add argument subtract_privs to revoke privileges explicitly (#333)
* add option subtract_privs to mysql_role and mysql_user

see https://github.com/ansible-collections/community.mysql/issues/331

* add integration tests for subtract_privs for mysql_role and mysql_user

* add changelog fragment for PR #333

* mysql_role, mysql_user: when subtract_privileges, don't grant unwanted privileges and don't revoke USAGE implicitly

* fix integration tests

* mysql_role, mysql_user: invalid privileges are ignored when subtract_privs is true -> document that and fix integration tests

* fix mysql_role integration tests

* fix mysql_role, mysql_user integration tests

* formatting

make the PEP8 check happy

* mysql_user and mysql_role: fix granting privileges when only the GRANT OPTION needs to be added

* mysql_user and mysql_role: log some updated privileges; explain integration test blind spot

* mysql_user and mysql_role: don't grant too much privileges

If only the grant option needs to be granted, at least one privilege needs to be granted to get valid syntax. USAGE is better for that than the existing privileges, because unwanted privileges would be re-added after revokation.

* mysql_user and mysql_role: fix type error

* Update changelogs/fragments/333-mysql_user-mysql_role-add-subtract_privileges-argument.yml

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

* Update plugins/modules/mysql_role.py

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

* Update plugins/modules/mysql_user.py

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

Co-authored-by: Felix Hamme <felix.hamme@ionos.com>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2022-05-09 09:50:49 +02:00
bigo8525
1dcc5ec086
mysql_user: added flush privileges to write dynamic privs into db (#338)
* added flush privileges to write dynamic privs into db
Fixes https://github.com/ansible-collections/community.mysql/issues/120

* added changelog fragment

* Update changelogs/fragments/338-mysql_user_fix_missing_dynamic_privileges.yml

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

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2022-04-29 12:38:12 +02:00
R.Sicart
4aab8ac808
Release 3.1.3 commit (#337) 2022-04-26 17:07:21 +02:00
Andrew Klychkov
450cb19027
mysql_replication: fix failing when using primary_use_gtid with replica_ or slave_pos (#336) 2022-04-21 17:43:08 +02:00
betanummeric
641894e6e8
mysql_role: remove redundant connection closing (fixes #329) (#330)
* mysql_role: remove redundant connection closing (fixes #329)

* add changelog fragment for pull request #330

Co-authored-by: Felix Hamme <felix.hamme@ionos.com>
2022-04-05 09:35:46 +02:00
R.Sicart
e319ac082e
CI: add testing against ansible-core 2.13 (#326)
Relates to https://github.com/ansible-collections/news-for-maintainers/issues/14
2022-04-02 17:53:21 +02:00
Andrew Klychkov
c16b2428e8
Copy ignore-2.13.txt to ignore-2.14.txt (#323)
* Copy ignore-2.13.txt to ignore-2.14.txt

* Fix sanity
2022-04-01 16:40:02 +02:00
Matthew Exon
82baf7508c
Clarified error message about missing python modules (#279)
* Clarified error message about missing python modules, and tweak documentation to suggest overriding interpreter.

* Mention mysqlclient as another option

* Correct mysqlclient suggestions from python2 to python3

Co-authored-by: Matthew Exon <git.mexon@spamgourmet.com>
2022-04-01 11:19:19 +02:00
Andrew Klychkov
5afae459dc
mysql_user: clarify behavior of priv parameter (#319) 2022-03-25 07:40:31 +01:00
Andrew Klychkov
e6e661b87f
Fix roles CI (#316) 2022-03-23 10:00:26 +01:00
R.Sicart
55458f5b0b
Setup patchback bot config file (resolves #310) (#311) 2022-03-17 09:30:29 +01:00
Andrew Klychkov
3a452faeb0
Add IF EXISTS clause to DROP USER statement (#307)
* Add IF EXISTS clause to DROP USER statement

* Add a changelog fragment

* Fix exception
2022-03-15 13:41:55 +01:00
Andrew Klychkov
1f16e65dfc
Release 3.1.2 commit #2 (#306) 2022-03-14 15:45:53 +01:00
Andrew Klychkov
5b1f1fe469
Release 3.1.2 commit (#304) 2022-03-14 15:34:02 +01:00
Andrew Klychkov
f00f06df76
Fix the collection to work with mysqlclient connector (#293)
* Integration tests: restrict exclusion mysqlclient + MariaDB only when testing the mysql_role module

* Fix

* Fix underlying issue

* Fix units

* Add changelog fragment
2022-03-14 10:03:47 +01:00
Andrew Klychkov
71a628f82d
Update requirements (#296) 2022-03-11 17:58:12 +01:00
R.Sicart
82cedf8510
Fix role integration tests for mariadb (#291)
* Fix: test_mysql_role : Check that the user have no active roles assertion

* Fix: test_mysql_role : Check in DB assertion

* Fix: test_mysql_role : Check in DB, if not granted, the query will fail for mariadb

* Fix: test_mysql_role : Check that the role is active assertion

* test_mysql_role : create checks for mariadb

* Make 'when' conditions uniform

* Fix: test_mysql_role : admin option tests

* test_mysql_role : create checks for mariadb

* Fix: add fixme on test which create role in check mode 'again'

It changes only on mariadb 10.2
(doesn't change on mysql 8 or mariadb 10.5)

* Fix: add fixme on test which create role 'again'

* Simplify test without checking Host part

* Fix 'show grant' checks for mariadb

* Enable mariadb tests for test_mysql_role target

* Add tests to verify role grants for roles

* Add FIXME comments for tests which do not pass on mariadb 10.2

* Fix FIXME tests related to mariadb 10.2

* Exclude mysqlclient==2.0.1 with mariadb from integration tests
2022-03-04 10:52:43 +01:00
Andrew Klychkov
c273ee36a7
Enable and fix integration tests for devel (#290)
* Enable and fix integration tests for devel

* Update repo targets

* Remove useless directive

* default container -> ubuntu1804

* revert last commit

* 10.2 does not support 20.04 focal; increase to 10.3
2022-03-01 17:57:20 +01:00
Andrew Klychkov
8052563a53
Release 3.1.1 commit (#289) 2022-02-16 11:38:07 +01:00
Andrew Klychkov
952e1666d8
Add a changelog fragment to PR 282 (#283) 2022-02-04 11:25:16 +01:00
Benoit Garret
f547b66d35
Honor the set_default_role_all parameter (#282)
The set_default_role_all parameter is documented, but does nothing. This PR fixes this.
2022-02-04 10:43:24 +01:00
Andrew Klychkov
cbdf51234a
Update CONTRIBUTORS file (#278) 2022-01-18 12:30:49 +01:00
Andrew Klychkov
c0619821de
Release 3.1.0 commit (#275) 2022-01-18 10:59:38 +01:00
Daniel Rupp
f5e8fbb3f5
Add default database "mysql" to mysql_user (#266)
* Add default database "mysql" to mysql_user

Since permissions are stored in the "mysql" database anyway this should not change the behaviour of the module. But replication / binlog filters which rely on the current database will be able to filter the statements correctly afterwards. Prior to this change they were not executed in any database context and could not be filtered in any way by the existing methods in MySQL.

* Added changelog fragment

* Update changelogs/fragments/266-default-database-for-mysql-user

Thanks!

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

* Update mysql_user.py

Make the change a configureable boolean

* Update 266-default-database-for-mysql-user

update changelog fragment

* Update 266-default-database-for-mysql-user

it´s not a bugfix anymore

* 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>

* renamed new option to force_context
enhanced description
added tests

* fixed changelog

* 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>

* added more tests

* removed first test attempts again (from issue-28.yml)
created new tests for testing with and without replication

* added force_context: no testing

* forgot to add the new part to main.yml

* found a copy&paste issue

* fix include naming

* Made sure the tests work in local testing

* MariaDB handles online replication filters differently

* fix changelog

* Update changelogs/fragments/266-default-database-for-mysql-user.yml

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

* Update changelogs/fragments/266-default-database-for-mysql-user.yml

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

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2022-01-10 16:03:25 +01:00