community.proxysql.proxysql_query_rules_fast_routing module – Modifies query rules for fast routing policies using the proxysql admin interface
Note
This module is part of the community.proxysql collection (version 1.4.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.proxysql
.
To use it in a playbook, specify: community.proxysql.proxysql_query_rules_fast_routing
.
New in version 1.1.0: of community.proxysql
Synopsis
The community.proxysql.proxysql_query_rules_fast_routing module modifies query rules for fast routing policies and attributes using the proxysql admin interface.
Requirements
The below requirements are needed on the host that executes this module.
PyMySQL
mysqlclient
Parameters
Parameter |
Comments |
---|---|
Free form text field, usable for a descriptive comment of the query rule. Default: “” |
|
Specify a config file from which login_user and login_password are to be read. Default: “” |
|
Route matched queries to this hostgroup. This happens unless there is a started transaction and the logged in user has transaction_persistent set to |
|
Evaluated in the same way as flagIN is in mysql_query_rules and correlates to the flagOUT/apply specified in the mysql_query_rules table. (see community.proxysql.proxysql_query_rules). Default: 0 |
|
By default, we avoid deleting more than one schedule in a single batch; however, if you need this behaviour and you are not concerned about the schedules deleted, you can set force_delete to Choices:
|
|
Dynamically load config to runtime memory. Choices:
|
|
The host used to connect to ProxySQL admin interface. Default: “127.0.0.1” |
|
The password used to authenticate to ProxySQL admin interface. |
|
The port used to connect to ProxySQL admin interface. Default: 6032 |
|
The socket used to connect to ProxySQL admin interface. |
|
The username used to authenticate to ProxySQL admin interface. |
|
Save config to sqlite db on disk to persist the configuration. Choices:
|
|
Filtering criteria matching schemaname, a query will match only if the connection uses schemaname as its default schema. |
|
When Choices:
|
|
Filtering criteria matching username, a query will match only if the connection is made with the correct username. |
Examples
---
# This example adds a rule for fast routing
- name: Add a rule
community.proxysql.proxysql_query_rules_fast_routing:
login_user: admin
login_password: admin
username: 'user_ro'
schemaname: 'default'
destination_hostgroup: 1
comment: 'fast route user_ro to default schema'
state: present
save_to_disk: yes
load_to_runtime: yes
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The mysql user modified or removed from proxysql. Returned: On create/update will return the newly modified rule, in all other cases will return a list of rules that match the supplied criteria. Sample: {“changed”: true, “msg”: “Added rule to mysql_query_rules_fast_routing”, “rules”: [{“comment”: “”, “destination_hostgroup”: 1, “flagIN”: “0”, “schemaname”: “default”, “username”: “user_ro”}], “state”: “present”} |
Authors
Akim Lindberg (@akimrx)