renamed new option to force_context

enhanced description
added tests
This commit is contained in:
Daniel Rupp 2021-12-23 12:38:48 +01:00
commit f151c0b451
2 changed files with 14 additions and 5 deletions

View file

@ -74,10 +74,16 @@ options:
- Whether binary logging should be enabled or disabled for the connection.
type: bool
default: yes
db_context:
force_context:
description:
- Sets the С(mysql) system database as context for the executed statements (it will be used as a database to connect to). Useful if you use
binlog / replication filters in MySQL.
- Sets the С(mysql) system database as context for the executed statements (it will be used
as a database to connect to). Useful if you use binlog / replication filters in MySQL as
per default the statements can not be caught by a binlog / replication filter, they require
a database to be set to work.
- see U(https://dev.mysql.com/doc/refman/8.0/en/replication-options-binary-log.html#option_mysqld_binlog-ignore-db)
for a description on how binlog filters work (filtering on the primary).
- see U(https://dev.mysql.com/doc/refman/8.0/en/replication-options-replica.html#option_mysqld_replicate-ignore-db)
for a description on how replication filters work (filtering on the replica).
type: bool
default: no
version_added: '3.1.0'
@ -348,7 +354,7 @@ def main():
plugin_hash_string=dict(default=None, type='str'),
plugin_auth_string=dict(default=None, type='str'),
resource_limits=dict(type='dict'),
db_context=dict(type='bool', default=False),
force_context=dict(type='bool', default=False),
)
module = AnsibleModule(
argument_spec=argument_spec,
@ -374,7 +380,7 @@ def main():
ssl_ca = module.params["ca_cert"]
check_hostname = module.params["check_hostname"]
db = ''
if module.params["db_context"]:
if module.params["force_context"]:
db = 'mysql'
sql_log_bin = module.params["sql_log_bin"]
plugin = module.params["plugin"]

View file

@ -30,6 +30,7 @@
<<: *mysql_params
name: '{{ user_name_1 }}'
state: absent
force_context: yes
ignore_errors: yes
- name: create user with ssl requirement
@ -38,6 +39,7 @@
name: "{{ user_name_1 }}"
password: "{{ user_password_1 }}"
priv: '*.*:ALL,GRANT'
force_context: yes
tls_requires:
SSL:
@ -84,3 +86,4 @@
name: '{{ user_name_1 }}'
host: 127.0.0.1
state: absent
force_context: yes