community.proxysql.proxysql_query_rules_fast_routing (1.5.1) — module

Modifies query rules for fast routing policies using the proxysql admin interface

| "added in version" 1.1.0 of community.proxysql"

Authors: Akim Lindberg (@akimrx)

Install collection

Install with ansible-galaxy collection install community.proxysql:==1.5.1


Add to requirements.yml

  collections:
    - name: community.proxysql
      version: 1.5.1

Description

The M(community.proxysql.proxysql_query_rules_fast_routing) module modifies query rules for fast routing policies and attributes using the proxysql admin interface.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
---
# 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: true
    load_to_runtime: true

Inputs

    
state:
    choices:
    - present
    - absent
    default: present
    description:
    - When C(present), adds the rule. When C(absent), removes the rule.
    type: str

flagIN:
    default: 0
    description:
    - Evaluated in the same way as I(flagIN) is in B(mysql_query_rules) and correlates
      to the I(flagOUT/apply) specified in the B(mysql_query_rules) table. (see M(community.proxysql.proxysql_query_rules)).
    type: int

comment:
    default: ''
    description:
    - Free form text field, usable for a descriptive comment of the query rule.
    type: str

username:
    description:
    - Filtering criteria matching username, a query will match only if the connection
      is made with the correct username.
    required: true
    type: str

login_host:
    default: 127.0.0.1
    description:
    - The host used to connect to ProxySQL admin interface.
    type: str

login_port:
    default: 6032
    description:
    - The port used to connect to ProxySQL admin interface.
    type: int

login_user:
    description:
    - The username used to authenticate to ProxySQL admin interface.
    type: str

schemaname:
    description:
    - Filtering criteria matching schemaname, a query will match only if the connection
      uses schemaname as its default schema.
    required: true
    type: str

config_file:
    default: ''
    description:
    - Specify a config file from which I(login_user) and I(login_password) are to be read.
    type: path

force_delete:
    default: false
    description:
    - 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 I(force_delete) to C(True).
    type: bool

save_to_disk:
    default: true
    description:
    - Save config to sqlite db on disk to persist the configuration.
    type: bool

login_password:
    description:
    - The password used to authenticate to ProxySQL admin interface.
    type: str

load_to_runtime:
    default: true
    description:
    - Dynamically load config to runtime memory.
    type: bool

login_unix_socket:
    description:
    - The socket used to connect to ProxySQL admin interface.
    type: str

destination_hostgroup:
    description:
    - 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)
      (refer to M(community.proxysql.proxysql_mysql_users)).
    required: true
    type: int

Outputs

stdout:
  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
  type: dict