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>
This commit is contained in:
betanummeric 2022-05-31 16:00:24 +02:00 committed by GitHub
commit ed3935abec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 232 additions and 27 deletions

View file

@ -0,0 +1,10 @@
minor_changes:
- >
mysql_user - Add the option ``on_new_username`` to argument ``update_password`` to reuse the password (plugin and
authentication_string) when creating a new user if some user with the same name already exists.
If the existing user with the same name have varying passwords, the password from the arguments is used like with
``update_password: always`` (https://github.com/ansible-collections/community.mysql/pull/365).
- >
mysql_user - Add the result field ``password_changed`` (boolean). It is true, when the user got a new password.
When the user was created with ``update_password: on_new_username`` and an existing password was reused,
``password_changed`` is false (https://github.com/ansible-collections/community.mysql/pull/365).