diff --git a/plugins/module_utils/user.py b/plugins/module_utils/user.py index 590d1a4..9de1c6d 100644 --- a/plugins/module_utils/user.py +++ b/plugins/module_utils/user.py @@ -286,7 +286,7 @@ def is_hash(password): def user_mod(cursor, user, host, host_all, password, encrypted, plugin, plugin_hash_string, plugin_auth_string, salt, new_priv, append_privs, subtract_privs, attributes, tls_requires, module, - password_expire, password_expire_interval, locked=False, role=False, maria_role=False): + password_expire, password_expire_interval, locked=None, role=False, maria_role=False): changed = False msg = "User unchanged" grant_option = False @@ -558,7 +558,7 @@ def user_mod(cursor, user, host, host_all, password, encrypted, if attribute_support: final_attributes = attributes_get(cursor, user, host) - if not role and user_is_locked(cursor, user, host) != locked: + if not role and locked is not None and user_is_locked(cursor, user, host) != locked: if not module.check_mode: if locked: cursor.execute("ALTER USER %s@%s ACCOUNT LOCK", (user, host)) diff --git a/plugins/modules/mysql_user.py b/plugins/modules/mysql_user.py index 075add9..9a89fc0 100644 --- a/plugins/modules/mysql_user.py +++ b/plugins/modules/mysql_user.py @@ -234,6 +234,7 @@ author: - Lukasz Tomaszkiewicz (@tomaszkiewicz) - kmarse (@kmarse) - Laurent Indermühle (@laurent-indermuehle) +- E.S. Rosenberg (@Keeper-of-the-Keys) extends_documentation_fragment: - community.mysql.mysql @@ -486,7 +487,7 @@ def main(): column_case_sensitive=dict(type='bool', default=None), # TODO 4.0.0 add default=True password_expire=dict(type='str', choices=['now', 'never', 'default', 'interval'], no_log=True), password_expire_interval=dict(type='int', required_if=[('password_expire', 'interval', True)], no_log=True), - locked=dict(type='bool', default='false'), + locked=dict(type='bool'), ) module = AnsibleModule( argument_spec=argument_spec,