Update mysql_user.py

Make the change a configureable boolean
This commit is contained in:
Daniel Rupp 2021-12-23 11:23:55 +01:00 committed by GitHub
commit 027b7ee48b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -74,6 +74,12 @@ options:
- Whether binary logging should be enabled or disabled for the connection. - Whether binary logging should be enabled or disabled for the connection.
type: bool type: bool
default: yes default: yes
db_context:
description:
- Sets the mysql system database as context for the executed statements. Useful if you use
binlog / replication filters in MySQL.
type: bool
default: no
state: state:
description: description:
- Whether the user should exist. - Whether the user should exist.
@ -341,6 +347,7 @@ def main():
plugin_hash_string=dict(default=None, type='str'), plugin_hash_string=dict(default=None, type='str'),
plugin_auth_string=dict(default=None, type='str'), plugin_auth_string=dict(default=None, type='str'),
resource_limits=dict(type='dict'), resource_limits=dict(type='dict'),
db_context=dict(type='bool', default=False),
) )
module = AnsibleModule( module = AnsibleModule(
argument_spec=argument_spec, argument_spec=argument_spec,
@ -365,7 +372,8 @@ def main():
ssl_key = module.params["client_key"] ssl_key = module.params["client_key"]
ssl_ca = module.params["ca_cert"] ssl_ca = module.params["ca_cert"]
check_hostname = module.params["check_hostname"] check_hostname = module.params["check_hostname"]
db = 'mysql' db = ''
db_context = module.params["db_context"]
sql_log_bin = module.params["sql_log_bin"] sql_log_bin = module.params["sql_log_bin"]
plugin = module.params["plugin"] plugin = module.params["plugin"]
plugin_hash_string = module.params["plugin_hash_string"] plugin_hash_string = module.params["plugin_hash_string"]
@ -379,6 +387,9 @@ def main():
if mysql_driver is None: if mysql_driver is None:
module.fail_json(msg=mysql_driver_fail_msg) module.fail_json(msg=mysql_driver_fail_msg)
if db_context:
db = 'mysql'
cursor = None cursor = None
try: try: