diff --git a/lib/ansible/modules/extras/database/proxysql/proxysql_query_rules.py b/lib/ansible/modules/extras/database/proxysql/proxysql_query_rules.py index 993f148511..8af46c6ab9 100644 --- a/lib/ansible/modules/extras/database/proxysql/proxysql_query_rules.py +++ b/lib/ansible/modules/extras/database/proxysql/proxysql_query_rules.py @@ -23,105 +23,128 @@ version_added: "2.3" author: "Ben Mildren (@bmildren)" short_description: Modifies query rules using the proxysql admin interface. description: - - The M(proxysql_query_rules) module modifies query rules using the proxysql admin interface. + - The M(proxysql_query_rules) module modifies query rules using the proxysql + admin interface. options: rule_id: description: - The unique id of the rule. Rules are processed in rule_id order. + [integer] active: description: - - A rule with I(active) set to C(False) will be tracked in the database, but will be never loaded in the in-memory data structures + - A rule with I(active) set to C(False) will be tracked in the database, + but will be never loaded in the in-memory data structures [boolean] username: description: - - Filtering criteria matching username. If I(username) is non-NULL, a query will match only if the connection is made with the correct username. + - Filtering criteria matching username. If I(username) is non-NULL, a + query will match only if the connection is made with the correct + username. [string] schemaname: description: - - Filtering criteria matching schemaname. If I(schemaname) is non-NULL, - a query will match only if the connection uses schemaname as its default schema. + - Filtering criteria matching schemaname. If I(schemaname) is + non-NULL, a query will match only if the connection uses schemaname as + its default schema. [string] flagIN: description: - - Used in combination with I(flagOUT) and I(apply) to create chains of rules. + - Used in combination with I(flagOUT) and I(apply) to create chains of + rules. [integer] client_addr: description: - - Match traffic from a specific source. + - Match traffic from a specific source. [string] proxy_addr: description: - - Match incoming traffic on a specific local IP. + - Match incoming traffic on a specific local IP. [string] proxy_port: description: - - Match incoming traffic on a specific local port. + - Match incoming traffic on a specific local port. [integer] digest: description: - - Match queries with a specific digest, as returned by stats_mysql_query_digest.digest. + - Match queries with a specific digest, as returned by + stats_mysql_query_digest.digest. [string] match_digest: description: - - "Regular expression that matches the query digest. - The dialect of regular expressions used is that of re2 - https://github.com/google/re2." + - Regular expression that matches the query digest. The dialect of + regular expressions used is that of re2 - + https://github.com/google/re2. [string] match_pattern: description: - - "Regular expression that matches the query text. The dialect of regular expressions used is that of re2 - https://github.com/google/re2." + - Regular expression that matches the query text. The dialect of regular + expressions used is that of re2 - https://github.com/google/re2. + [string] negate_match_pattern: description: - If I(negate_match_pattern) is set to C(True), only queries not matching the query text will be considered as a match. This acts as a NOT operator in front of the regular expression matching against - match_pattern. + match_pattern. [boolean] flagOUT: description: - Used in combination with I(flagIN) and apply to create chains of rules. When set, I(flagOUT) signifies the I(flagIN) to be used in the next - chain of rules. + chain of rules. [integer] replace_pattern: description: - This is the pattern with which to replace the matched pattern. Note that this is optional, and when ommitted, the query processor will only - cache, route, or set other parameters without rewriting. + cache, route, or set other parameters without rewriting. [string] destination_hostgroup: description: - - Route matched queries to this hostgroup. This happens unless there is a started transaction and the logged in user has + - Route matched queries to this hostgroup. This happens unless there is + a started transaction and the logged in user has I(transaction_persistent) set to C(True) (see M(proxysql_mysql_users)). + [integer] cache_ttl: description: - The number of milliseconds for which to cache the result of the query. - Note in ProxySQL 1.1 I(cache_ttl) was in seconds. + Note in ProxySQL 1.1 I(cache_ttl) was in seconds. [integer] timeout: description: - The maximum timeout in milliseconds with which the matched or rewritten query should be executed. If a query run for longer than the specific threshold, the query is automatically killed. If timeout is not specified, the global variable mysql-default_query_timeout applies. + [integer] retries: description: - - The maximum number of times a query needs to be re-executed in case of detected failure during the execution of the query. - If retries is not specified, the global variable mysql-query_retries_on_failure applies. + - The maximum number of times a query needs to be re-executed in case of + detected failure during the execution of the query. If retries is not + specified, the global variable mysql-query_retries_on_failure applies. + [integer] delay: description: - Number of milliseconds to delay the execution of the query. This is essentially a throttling mechanism and QoS, and allows a way to give priority to queries over others. This value is added to the mysql-default_query_delay global variable that applies to all queries. + [integer] mirror_flagOUT: description: - Enables query mirroring. If set I(mirror_flagOUT) can be used to evaluates the mirrored query against the specified chain of rules. + [integer] mirror_hostgroup: description: - - Enables query mirroring. If set I(mirror_hostgroup) can be used to mirror queries to the same or different hostgroup. + - Enables query mirroring. If set I(mirror_hostgroup) can be used to + mirror queries to the same or different hostgroup. [integer] error_msg: description: - - Query will be blocked, and the specified error_msg will be returned to the client. + - Query will be blocked, and the specified error_msg will be returned to + the client. [string] log: description: - - Query will be logged. + - Query will be logged. [boolean] apply: description: - - Used in combination with I(flagIN) and I(flagOUT) to create chains of rules. Setting apply to True signifies the last rule to be applied. + - Used in combination with I(flagIN) and I(flagOUT) to create chains of + rules. Setting apply to True signifies the last rule to be applied. + [boolean] comment: description: - - Free form text field, usable for a descriptive comment of the query rule. + - Free form text field, usable for a descriptive comment of the query + rule. [string] state: description: - - "When C(present) - adds the rule, when C(absent) - removes the rule." + - When C(present) - adds the rule, when C(absent) - removes the rule. choices: [ "present", "absent" ] default: present force_delete: @@ -132,7 +155,8 @@ options: default: False save_to_disk: description: - - Save mysql host config to sqlite db on disk to persist the configuration. + - Save mysql host config to sqlite db on disk to persist the + configuration. default: True load_to_runtime: description: @@ -156,17 +180,20 @@ options: default: 6032 config_file: description: - - Specify a config file from which login_user and login_password are to be read + - Specify a config file from which login_user and login_password are to + be read default: '' ''' EXAMPLES = ''' +--- # This example adds a rule to redirect queries from a specific user to another # hostgroup, it saves the mysql query rule config to disk, but avoids loading -# the mysql query config config to runtime (this might be because several +# the mysql query config config to runtime (this might be because several # rules are being added and the user wants to push the config to runtime in a # single batch using the M(proxysql_manage_config) module). It uses supplied # credentials to connect to the proxysql admin interface. + - proxysql_backend_servers: login_user: admin login_password: admin