community.proxysql.proxysql_pgsql_users module – Adds or removes postgresql users from proxysql admin interface
Note
This module is part of the community.proxysql collection (version 1.8.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. You need further requirements to be able to use this module, see Requirements for details.
To use it in a playbook, specify: community.proxysql.proxysql_pgsql_users.
New in community.proxysql 1.8.0
Synopsis
- The community.proxysql.proxysql_pgsql_users module adds or removes postgresql users using the proxysql admin interface.
Requirements
The below requirements are needed on the host that executes this module.
- PyMySQL
- mysqlclient
Parameters
Parameter | Comments |
|---|---|
active boolean | A user with active set to Choices:
|
backend boolean | If backend is set to Choices:
|
config_file path | Specify a config file from which login_user and login_password are to be read. Default: |
default_hostgroup integer | 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 default_hostgroup is 0. |
fast_forward boolean | If fast_forward is set to Choices:
|
frontend boolean | If frontend is set to Choices:
|
load_to_runtime boolean | Dynamically load config to runtime memory. Choices:
|
login_host string | The host used to connect to ProxySQL admin interface. Default: |
login_password string | The password used to authenticate to ProxySQL admin interface. |
login_port integer | The port used to connect to ProxySQL admin interface. Default: |
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. |
max_connections integer | 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 string | Password of the user connecting to the postgresql or ProxySQL instance. |
save_to_disk boolean | Save config to sqlite db on disk to persist the configuration. Choices:
|
state string | When Choices:
|
transaction_persistent boolean | If this is set for the user with which the PostgreSQL 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 Choices:
|
use_ssl boolean | If use_ssl is set to Choices:
|
username string / required | Name of the user connecting to the postgresql or ProxySQL instance. |
Attributes
Attribute | Support | Description |
|---|---|---|
check_mode | Support: full | Do not make any changes to memory, disk, or runtime. |
Examples
---
# This example adds a user, it saves the postgresql user config to disk, but
# avoids loading the postgresql 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_pgsql_users:
login_user: 'admin'
login_password: 'admin'
username: 'productiondba'
state: present
load_to_runtime: false
# This example removes a user, saves the postgresql user config to disk, and
# dynamically loads the postgresql 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_pgsql_users:
config_file: '~/proxysql.cnf'
username: 'postgresboy'
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Description |
|---|---|
stdout dictionary | The postgresql 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: |
Collection links
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/projects/ansible/latest/collections/community/proxysql/proxysql_pgsql_users_module.html