community.general.proxysql_manage_config (0.2.1) — module

Writes the proxysql configuration settings between layers.

Authors: Ben Mildren (@bmildren)

Install collection

Install with ansible-galaxy collection install community.general:==0.2.1


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.2.1

Description

The M(proxysql_global_variables) module writes the proxysql configuration settings between layers. Currently this module will always report a changed state, so should typically be used with WHEN however this will change in a future version when the CHECKSUM table commands are available for all tables in proxysql.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
---
# This example saves the mysql users config from memory to disk. It uses
# supplied credentials to connect to the proxysql admin interface.

- name: Save the mysql users config from memory to disk
  proxysql_manage_config:
    login_user: 'admin'
    login_password: 'admin'
    action: "SAVE"
    config_settings: "MYSQL USERS"
    direction: "FROM"
    config_layer: "MEMORY"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# This example loads the mysql query rules config from memory to runtime. It
# uses supplied credentials to connect to the proxysql admin interface.

- name: Load the mysql query rules config from memory to runtime
  proxysql_manage_config:
    config_file: '~/proxysql.cnf'
    action: "LOAD"
    config_settings: "MYSQL QUERY RULES"
    direction: "TO"
    config_layer: "RUNTIME"

Inputs

    
action:
    choices:
    - LOAD
    - SAVE
    description:
    - The supplied I(action) combines with the supplied I(direction) to provide the semantics
      of how we want to move the I(config_settings) between the I(config_layers).
    required: true

direction:
    choices:
    - FROM
    - TO
    description:
    - FROM - denotes we're reading values FROM the supplied I(config_layer) and writing
      to the next layer. TO - denotes we're reading from the previous layer and writing
      TO the supplied I(config_layer)."
    required: true

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

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

config_layer:
    choices:
    - MEMORY
    - DISK
    - RUNTIME
    - CONFIG
    description:
    - RUNTIME - represents the in-memory data structures of ProxySQL used by the threads
      that are handling the requests. MEMORY - (sometimes also referred as main) represents
      the in-memory SQLite3 database. DISK - represents the on-disk SQLite3 database.
      CONFIG - is the classical config file. You can only LOAD FROM the config file.
    required: true

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

config_settings:
    choices:
    - MYSQL USERS
    - MYSQL SERVERS
    - MYSQL QUERY RULES
    - MYSQL VARIABLES
    - ADMIN VARIABLES
    - SCHEDULER
    description:
    - The I(config_settings) specifies which configuration we're writing.
    required: true

Outputs

stdout:
  description: Simply reports whether the action reported a change.
  returned: Currently the returned value with always be changed=True.
  sample:
    changed: true
  type: dict