W3cubDocs

/Ansible

proxysql_replication_hostgroups - Manages replication hostgroups using the proxysql admin interface.

New in version 2.3.

Synopsis

  • Each row in mysql_replication_hostgroups represent a pair of writer_hostgroup and reader_hostgroup. ProxySQL will monitor the value of read_only for all the servers in specified hostgroups, and based on the value of read_only will assign the server to the writer or reader hostgroups.

Options

parameter required default choices comments
comment
no
Text field that can be used for any purposed defined by the user.
config_file
no
Specify a config file from which login_user and login_password are to be read.
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.
reader_hostgroup
yes
Id of the reader hostgroup.
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 replication hostgroup, when absent - removes the replication hostgroup.
writer_hostgroup
yes
Id of the writer hostgroup.

Examples

---
# This example adds a replication hostgroup, it saves the mysql server config
# to disk, but avoids loading the mysql server config to runtime (this might be
# because several replication hostgroup 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_replication_hostgroups:
    login_user: 'admin'
    login_password: 'admin'
    writer_hostgroup: 1
    reader_hostgroup: 2
    state: present
    load_to_runtime: False

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

- proxysql_replication_hostgroups:
    config_file: '~/proxysql.cnf'
    writer_hostgroup: 3
    reader_hostgroup: 4
    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 replication hostgroup modified or removed from proxysql
On create/update will return the newly modified group, on delete it will return the deleted record. dict {'msg': 'Added server to mysql_hosts', 'repl_group': {'comment': '', 'reader_hostgroup': '1', 'writer_hostgroup': '2'}, 'state': 'present', 'changed': True}

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–2017 Michael DeHaan
© 2017 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/proxysql_replication_hostgroups_module.html