Note
This plugin is part of the community.proxysql collection (version 1.3.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
.
To use it in a playbook, specify: community.proxysql.proxysql_replication_hostgroups
.
The below requirements are needed on the host that executes this module.
Parameter | Choices/Defaults | Comments |
---|---|---|
check_type string added in 1.3.0 of community.proxysql |
| Which check type to use when detecting that the node is a standby. Requires proxysql >= 2.0.1. Otherwise it has no effect. read_only|innodb_read_only and read_only&innodb_read_only requires proxysql >= 2.0.8. |
comment string | Default: "" | Text field that can be used for any purposes defined by the user. |
config_file path | Default: "" | Specify a config file from which login_user and login_password are to be read. |
load_to_runtime boolean |
| Dynamically load config to runtime memory. |
login_host string | Default: "127.0.0.1" | The host used to connect to ProxySQL admin interface. |
login_password string | The password used to authenticate to ProxySQL admin interface. | |
login_port integer | Default: 6032 | The port used to connect to ProxySQL admin interface. |
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. | |
reader_hostgroup integer / required | Id of the reader hostgroup. | |
save_to_disk boolean |
| Save config to sqlite db on disk to persist the configuration. |
state string |
| When present - adds the replication hostgroup, when absent - removes the replication hostgroup. |
writer_hostgroup integer / required | Id of the writer hostgroup. |
Note
check_mode
.--- # 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 # community.general.proxysql_manage_config module). It uses supplied credentials # to connect to the proxysql admin interface. - name: Add a replication hostgroup community.proxysql.proxysql_replication_hostgroups: login_user: 'admin' login_password: 'admin' writer_hostgroup: 1 reader_hostgroup: 2 state: present load_to_runtime: False - name: Change check_type community.proxysql.proxysql_replication_hostgroups: login_user: 'admin' login_password: 'admin' writer_hostgroup: 1 reader_hostgroup: 2 check_type: innodb_read_only 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. - name: Remove a replication hostgroup community.proxysql.proxysql_replication_hostgroups: config_file: '~/proxysql.cnf' writer_hostgroup: 3 reader_hostgroup: 4 state: absent
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
stdout dictionary | On create/update will return the newly modified group, on delete it will return the deleted record. | The replication hostgroup modified or removed from proxysql. Sample: {'changed': True, 'msg': 'Added server to mysql_hosts', 'repl_group': {'check_type': 'read_only', 'comment': '', 'reader_hostgroup': '1', 'writer_hostgroup': '2'}, 'state': 'present'} |
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/proxysql/proxysql_replication_hostgroups_module.html