W3cubDocs

/Ansible

community.proxysql.proxysql_query_rules_fast_routing – Modifies query rules for fast routing policies using the proxysql admin interface

Note

This plugin is part of the community.proxysql collection (version 1.3.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

Requirements

The below requirements are needed on the host that executes this module.

  • PyMySQL
  • mysqlclient

Parameters

Parameter Choices/Defaults Comments
comment
string
Default:
""
Free form text field, usable for a descriptive comment of the query rule.
config_file
path
Default:
""
Specify a config file from which login_user and login_password are to be read.
destination_hostgroup
integer / required
Route matched queries to this hostgroup. This happens unless there is a started transaction and the logged in user has transaction_persistent set to True (refer to community.proxysql.proxysql_mysql_users).
flagIN
integer
Default:
0
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).
force_delete
boolean
    Choices:
  • no
  • yes
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 True.
load_to_runtime
boolean
    Choices:
  • no
  • yes
Dynamically load config to runtime memory.
login_host
string
Default:
"127.0.0.1"
The host used to connect to ProxySQL admin interface.
login_password
string
The password used to authenticate to ProxySQL admin interface.
login_port
integer
Default:
6032
The port used to connect to ProxySQL admin interface.
login_unix_socket
string
The socket used to connect to ProxySQL admin interface.
login_user
string
The username used to authenticate to ProxySQL admin interface.
save_to_disk
boolean
    Choices:
  • no
  • yes
Save config to sqlite db on disk to persist the configuration.
schemaname
string / required
Filtering criteria matching schemaname, a query will match only if the connection uses schemaname as its default schema.
state
string
    Choices:
  • present
  • absent
When present, adds the rule. When absent, removes the rule.
username
string / required
Filtering criteria matching username, a query will match only if the connection is made with the correct username.

Notes

Note

  • Supports check_mode.

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 Returned Description
stdout
dictionary
On create/update will return the newly modified rule, in all other cases will return a list of rules that match the supplied criteria.
The mysql user modified or removed from proxysql.

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)

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/proxysql/proxysql_query_rules_fast_routing_module.html