proxysql_mysql_users - Adds or removes mysql users from proxysql admin interface.

New in version 2.3.

Synopsis

Options

parameter required default choices comments
active
no
A user with active set to False will be tracked in the database, but will be never loaded in the in-memory data structures. If omitted the proxysql database default for active is True.
backend
no True
If backend is set to True, this (username, password) pair is used for authenticating to the ProxySQL instance.
config_file
no
Specify a config file from which login_user and login_password are to be read.
default_hostgroup
no
If there is no matching rule for the queries sent by this user, the traffic it generates is sent to the specified hostgroup. If omitted the proxysql database default for use_ssl is 0.
default_schema
no
The schema to which the connection should change to by default.
fast_forward
no
If fast_forward is set to True, fast_forward will bypass the query processing layer (rewriting, caching) and pass through the query directly as is to the backend server. If omitted the proxysql database default for fast_forward is False.
frontend
no True
If frontend is set to True, this (username, password) pair is used for authenticating to the mysqld servers against any hostgroup.
load_to_runtime
no True
Dynamically load mysql host config to runtime memory.
login_host
no 127.0.0.1
The host used to connect to ProxySQL admin interface.
login_password
no None
The password used to authenticate to ProxySQL admin interface.
login_port
no 6032
The port used to connect to ProxySQL admin interface.
login_user
no None
The username used to authenticate to ProxySQL admin interface.
max_connections
no
The maximum number of connections ProxySQL will open to the backend for this user. If omitted the proxysql database default for max_connections is 10000.
password
no
Password of the user connecting to the mysqld or ProxySQL instance.
save_to_disk
no True
Save mysql host config to sqlite db on disk to persist the configuration.
state
no present
  • present
  • absent
When present - adds the user, when absent - removes the user.
transaction_persistent
no
If this is set for the user with which the MySQL client is connecting to ProxySQL (thus a "frontend" user), transactions started within a hostgroup will remain within that hostgroup regardless of any other rules. If omitted the proxysql database default for transaction_persistent is False.
use_ssl
no
If use_ssl is set to True, connections by this user will be made using SSL connections. If omitted the proxysql database default for use_ssl is False.
username
yes
Name of the user connecting to the mysqld or ProxySQL instance.

Examples

---
# This example adds a user, it saves the mysql user config to disk, but
# avoids loading the mysql user config to runtime (this might be because
# several users 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_mysql_users:
    login_user: 'admin'
    login_password: 'admin'
    username: 'productiondba'
    state: present
    load_to_runtime: False

# This example removes a user, saves the mysql user config to disk, and
# dynamically loads the mysql user config to runtime.  It uses credentials
# in a supplied config file to connect to the proxysql admin interface.

- proxysql_mysql_users:
    config_file: '~/proxysql.cnf'
    username: 'mysqlboy'
    state: absent

Return Values

Common return values are documented here Return Values, the following are the fields unique to this module:

name description returned type sample
stdout
The mysql user modified or removed from proxysql
On create/update will return the newly modified user, on delete it will return the deleted record. dict {'msg': 'Added user to mysql_users', 'username': 'guest_ro', 'state': 'present', 'changed': True, 'user': {'default_hostgroup': 1, 'username': 'guest_ro', 'frontend': 1, 'default_schema': None, 'transaction_persistent': 0, 'schema_locked': 0, 'backend': 1, 'fast_forward': 0, 'active': 1, 'use_ssl': 0, 'password': 'VALUE_SPECIFIED_IN_NO_LOG_PARAMETER', 'max_connections': 10000}}

Status

This module is flagged as stableinterface which means that the maintainers for this module guarantee that no backward incompatible interface changes will be made.

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.4/proxysql_mysql_users_module.html