{"id":20551732,"url":"https://github.com/do-community/ansible-role-proxysql","last_synced_at":"2025-10-04T00:11:01.014Z","repository":{"id":90797356,"uuid":"125429948","full_name":"do-community/ansible-role-proxysql","owner":"do-community","description":"Ansible role to set up ProxySQL for MySQL group replication hosts","archived":false,"fork":false,"pushed_at":"2018-03-15T21:54:13.000Z","size":9,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-16T17:01:02.397Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/do-community.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-15T21:48:58.000Z","updated_at":"2020-03-10T14:40:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"a07e2b91-ff4d-47f4-ab26-32eb91230ec7","html_url":"https://github.com/do-community/ansible-role-proxysql","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/do-community%2Fansible-role-proxysql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/do-community%2Fansible-role-proxysql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/do-community%2Fansible-role-proxysql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/do-community%2Fansible-role-proxysql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/do-community","download_url":"https://codeload.github.com/do-community/ansible-role-proxysql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242157191,"owners_count":20081037,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T02:33:23.274Z","updated_at":"2025-10-04T00:10:55.981Z","avatar_url":"https://github.com/do-community.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"proxysql\n========\n\nA ProxySQL role capable proxying secure connections to a MySQL group replication cluster.\n\nRequirements\n------------\n\nRequires a MySQL group configured by DigitalOcean's MySQL role (to grab the SSL assets necessary to secure the connection to the backend group).\n\nRole Variables\n--------------\n\n```\n# Type: boolean\n# Default: false\n# Description: Whether the backends are using multi-primary replication or not.\nproxysql_multi_primary: true\n\n# Type: string\n# Default: /var/lib/proxysql\n# Description: The directory to store ProxySQL's data files\nproxysql_datadir: /var/lib/proxysql\n\n# Type: list\n# Default: (none)\n# Description: A list of MySQL servers configured with group replication to use\n# as the backend.  It's probably easiest to populate this with an Ansible\n# group, as shown here.\nproxysql_mysql_backend_servers: \"{{ groups['mysql_nodes'] }}\"\n\n# Type: list of dictionaries\n# Default: (none)\n# Description: A list of dictionaries defining MySQL users that should be\n# accessible.  These groupings will be used to create the ProxySQL accounts to\n# pass through, and will be used to create local MySQL option files to ease\n# logging in.  Keys that should be defined for each item are: `user`,\n# `password`, `filename`, `port`, and `prompt`.  An admin user for the local\n# ProxySQL instance (connecting on proxy_admin_interface` and\n# `proxy_admin_port`) is always required.\nproxysql_user_data:\n    - user: \"{{ proxysql_admin_user }}\"\n      password: \"{{ proxysql_admin_password }}\"\n      filename: .my.cnf\n      port: \"{{ proxysql_admin_port }}\"\n      prompt: \"ProxySQLAdmin\u003e \"\n    - user: testuser\n      password: testpass\n      filename: testuser.cnf\"\n      port: \"{{ proxysql_mysql_port }}\"\n      default_hostgroup: 2\n      prompt: \"{{ proxysql_group_test_user }}\u003e \"\n\n# Type: boolean\n# Default: false\n# Description: Whether SSL is required by the MySQL backend group.\nproxysql_require_ssl: true\n\n# Type: boolean\n# Default: false\n# Description: Whether ProxySQL should use private network to connect to the backend hosts\nproxysql_private_networking: true\n\n# Type: integer\n# Default: 1\n# Description: The identifier for the group replication \"offline\" hostgroup.\nproxysql_GR_hostgroups_offline_hostgroup: 1\n\n# Type: integer\n# Default: 2\n# Description: The identifier for the group replication \"writer\" hostgroup.\nproxysql_GR_hostgroups_writer_hostgroup: 2\n\n# Type: integer\n# Default: 3\n# Description: The identifier for the group replication \"reader\" hostgroup.\nproxysql_GR_hostgroups_reader_hostgroup: 3\n\n# Type: integer\n# Default: 4\n# Description: The identifier for the group replication \"backup writer\"\n# hostgroup.\nproxysql_GR_hostgroups_backup_writer_hostgroup: 4\n\n# Type: integer\n# Default: 1 when multi-primary is off, # of backends when multi-primary is on\n# Description: The maximum number of writers that should be active in a hostgroup.\nproxysql_GR_hostgroups_max_writers: \"{{ proxysql_mysql_backend_servers | length if proxysql_multi_primary else 1 }}\"\n\n# Type: integer (as boolean)\n# Default: 1 (indicating true)\n# Description: ProxySQL uses integers to represent some booleans.  This\n# variable indicates whether hosts in the writer hostgroup should also be\n# automatically added to the reader hostgroup.\nproxysql_GR_hostgroups_writer_is_also_reader: 1\n\n# Type: integer (as boolean)\n# Default: 1 (indicating true)\n# Description: ProxySQL uses integers to represent some booleans.  This\n# variable indicates whether the hostgroup should be marked as active\n# immediately.\nproxysql_GR_hostgroups_active: 1\n\n# Type: integer\n# Default: 100\n# Description: The maximum number of transactions a backend host can be behind before it is shunned by the ProxySQL host (taken out of rotation).\nproxysql_GR_hostgroups_max_transactions_behind: 100\n```\n\nThere are many additional variables that are parameterized versions of the ProxySQL admin and mysql variables.  You can find more about what each is responsible for by reading the [ProxySQL wiki page on global variables](https://github.com/sysown/proxysql/wiki/Global-variables).\n\nCheck this role's `defaults/main` file for a full list.  Admin variables use the prefix `proxysql_admin_` and mysql variables use the prefix `proxysql_mysql_`.  While most of the defaults are probably fine, you should change the variables associated with credentials (except for `proxysql_admin_cluster_username` and `proxysql_admin_cluster_password`) before deployment:\n\n* proxysql_admin_user\n* proxysql_admin_password\n* proxysql_admin_stats_user\n* proxysql_admin_stats_password\n* proxysql_mysql_monitor_username\n* proxysql_mysql_monitor_password\n\nAdditionally, there are some container variables configured in this role's `vars/main.yml` file that interpolate and structure the user editable variables.  These are internal structures that you will not need to edit yourself.\n\nDependencies\n------------\n\n* DigitalOcean's `mysql` role for the backend MySQL servers.\n\nExample Playbook\n----------------\n\n```\n---\n- name: Set up ProxySQL to balance group\n  hosts: mysql_proxy\n  vars:\n    proxysql_admin_user: admin\n    proxysql_admin_password: admin\n    proxysql_mysql_backend_servers:\n      - mysql-node-1\n      - mysql-node-2\n      - mysql-node-3\n    proxysql_require_ssl: true\n    proxysql_group_monitor_user: monitor\n    proxysql_group_monitor_pass: monitorpassword\n    proxysql_user_data:\n        - user: \"{{ proxysql_admin_user }}\"\n          password: \"{{ proxysql_admin_password }}\"\n          filename: .my.cnf\n          port: \"{{ proxysql_admin_port }}\"\n          prompt: \"ProxySQLAdmin\u003e \"\n        - user: testuser\n          password: testpass\n          filename: \"testuser.cnf\"\n          port: \"{{ proxysql_mysql_port }}\"\n          default_hostgroup: 2\n          prompt: \"testuser\u003e \"\n\n  roles:\n    - role: proxysql\n```\n\nLicense\n-------\n\nMIT\n\nAuthor Information\n------------------\n\nDigitalOcean Community\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdo-community%2Fansible-role-proxysql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdo-community%2Fansible-role-proxysql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdo-community%2Fansible-role-proxysql/lists"}