community / community.proxysql / 1.5.1 / module / proxysql_mysql_users Adds or removes mysql users from proxysql admin interface Authors: Ben Mildren (@bmildren)community.proxysql.proxysql_mysql_users (1.5.1) — module
Install with ansible-galaxy collection install community.proxysql:==1.5.1
collections: - name: community.proxysql version: 1.5.1
The M(community.proxysql.proxysql_mysql_users) module adds or removes mysql users using the proxysql admin interface.
--- # 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 community.general.proxysql_manage_config # module). It uses supplied credentials to connect to the proxysql admin # interface. - name: Add a user community.proxysql.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. - name: Remove a user community.proxysql.proxysql_mysql_users: config_file: '~/proxysql.cnf' username: 'mysqlboy' state: absent
state: choices: - present - absent default: present description: - When C(present) - adds the user, when C(absent) - removes the user. type: str active: description: - A user with I(active) set to C(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 I(active) is C(True). type: bool backend: default: true description: - If I(backend) is set to C(True), this (username, password) pair is used for authenticating to the ProxySQL instance. type: bool use_ssl: description: - If I(use_ssl) is set to C(True), connections by this user will be made using SSL connections. If omitted the proxysql database default for I(use_ssl) is C(False). type: bool frontend: default: true description: - If I(frontend) is set to C(True), this (username, password) pair is used for authenticating to the mysqld servers against any hostgroup. type: bool password: description: - Password of the user connecting to the mysqld or ProxySQL instance. type: str username: description: - Name of the user connecting to the mysqld or ProxySQL instance. 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 config_file: default: '' description: - Specify a config file from which I(login_user) and I(login_password) are to be read. type: path fast_forward: description: - If I(fast_forward) is set to C(True), I(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 I(fast_forward) is C(False). type: bool save_to_disk: default: true description: - Save config to sqlite db on disk to persist the configuration. type: bool default_schema: description: - The schema to which the connection should change to by default. type: str 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 max_connections: description: - The maximum number of connections ProxySQL will open to the backend for this user. If omitted the proxysql database default for I(max_connections) is 10000. type: int encrypt_password: default: false description: - Encrypt a cleartext password passed in the I(password) option, using the method defined in I(encryption_method). type: bool default_hostgroup: description: - 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 I(use_ssl) is 0. type: int encryption_method: choices: - mysql_native_password default: mysql_native_password description: - Encryption method used when I(encrypt_password) is set to C(True). type: str login_unix_socket: description: - The socket used to connect to ProxySQL admin interface. type: str transaction_persistent: description: - 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 I(transaction_persistent) is C(False). type: bool
stdout: description: The mysql user modified or removed from proxysql. returned: On create/update will return the newly modified user, on delete it will return the deleted record. sample: changed: true msg: Added user to mysql_users state: present user: active: 1 backend: 1 default_hostgroup: 1 default_schema: null fast_forward: 0 frontend: 1 max_connections: 10000 password: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER schema_locked: 0 transaction_persistent: 0 use_ssl: 0 username: guest_ro username: guest_ro type: dict