diff options
Diffstat (limited to 'collections-debian-merged/ansible_collections/community/proxysql/roles')
17 files changed, 1010 insertions, 0 deletions
diff --git a/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/.yamllint b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/.yamllint new file mode 100644 index 00000000..a0270865 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/.yamllint @@ -0,0 +1,11 @@ +--- +extends: default + +rules: + braces: + max-spaces-inside: 1 + level: error + brackets: + max-spaces-inside: 1 + level: error + line-length: disable diff --git a/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/README.md b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/README.md new file mode 100644 index 00000000..5cc42b1b --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/README.md @@ -0,0 +1,43 @@ +Ansible Role: ProxySQL +====================== + +This role installs, and configures ProxySQL. + +Requirements +------------ + +None + +Role Variables +-------------- + +As with all roles designed in Data Platforms, the interface to variables in this role should only be via the role defaults, and it shouldn't be necessary to override the role vars. + +A full list of defaults and their values can be found in the `defaults/main.yml`. + +Dependencies +------------ + +None + +Example Playbook +---------------- + +``` + - hosts: servers + tasks: + - import_role: + name: role_mysql_proxysql + tags: + - proxysql +``` + +License +------- + +BSD + +Author Information +------------------ + +Ben Mildren diff --git a/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/defaults/main.yml b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/defaults/main.yml new file mode 100644 index 00000000..93781561 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/defaults/main.yml @@ -0,0 +1,171 @@ +--- +### proxysql install +proxysql_download_src: https://github.com/sysown/proxysql/releases/download +proxysql_version: 2.0.10 +proxysql_mysql_client_version: 5.7 +proxysql_mysql_use_custom_build: false +proxysql_force_restart: false + +proxysql_user: proxysql +proxysql_group: proxysql +proxysql_datadir: /var/lib/proxysql + +proxysql_restart_missing_heartbeats: 10 + +### admin variables +proxysql_admin_user: admin +proxysql_admin_password: admin +proxysql_admin_stats_user: stats +proxysql_admin_stats_password: stats +proxysql_admin_bind_address: 0.0.0.0 +proxysql_admin_port: 6032 +proxysql_admin_socket: /tmp/proxysql_admin.sock +proxysql_admin_read_only: false +proxysql_admin_refresh_interval: 2000 +proxysql_admin_hash_passwords: true + +# cluster +proxysql_admin_cluster_username: +proxysql_admin_cluster_password: +proxysql_admin_cluster_check_interval_ms: 1000 +proxysql_admin_cluster_check_status_frequency: 10 +proxysql_admin_cluster_proxysql_servers_diffs_before_sync: 3 +proxysql_admin_cluster_proxysql_servers_save_to_disk: true +proxysql_admin_checksum_mysql_query_rules: true +proxysql_admin_cluster_mysql_query_rules_diffs_before_sync: 3 +proxysql_admin_cluster_mysql_query_rules_save_to_disk: true +proxysql_admin_checksum_mysql_servers: true +proxysql_admin_cluster_mysql_servers_diffs_before_sync: 3 +proxysql_admin_cluster_mysql_servers_save_to_disk: true +proxysql_admin_checksum_mysql_users: true +proxysql_admin_cluster_mysql_users_diffs_before_sync: 3 +proxysql_admin_cluster_mysql_users_save_to_disk: true + +# historical stats +proxysql_admin_stats_system_cpu: 60 +proxysql_admin_stats_system_memory: 60 +proxysql_admin_stats_mysql_connection_pool: 60 +proxysql_admin_stats_mysql_connections: 60 +proxysql_admin_stats_mysql_query_cache: 60 + +# web interface +proxysql_admin_web_enabled: false +proxysql_admin_web_port: 6080 + + +### mysql variables +proxysql_mysql_bind_address: 0.0.0.0 +proxysql_mysql_port: 6033 +proxysql_mysql_socket: /tmp/proxysql.sock + +# connection pool +proxysql_mysql_connect_retries_delay: 1 +proxysql_mysql_connect_retries_on_failure: 10 +proxysql_mysql_connect_timeout_server: 3000 +proxysql_mysql_connect_timeout_server_max: 10000 +proxysql_mysql_connection_delay_multiplex_ms: 0 +proxysql_mysql_connection_max_age_ms: 0 +proxysql_mysql_connpoll_reset_queue_length: 50 +proxysql_mysql_default_max_latency_ms: 1000 +proxysql_mysql_free_connections_pct: 10 +proxysql_mysql_max_connections: 2048 +proxysql_mysql_multiplexing: true +proxysql_mysql_ping_interval_server_msec: 120000 +proxysql_mysql_ping_timeout_server: 500 +proxysql_mysql_poll_timeout: 2000 +proxysql_mysql_poll_timeout_on_failure: 100 +proxysql_mysql_session_idle_ms: 1000 +proxysql_mysql_session_idle_show_processlist: true +proxysql_mysql_sessions_sort: true +proxysql_mysql_shun_on_failures: 5 +proxysql_mysql_shun_recovery_time_sec: 10 +proxysql_mysql_stacksize: 1048576 +proxysql_mysql_threads: 4 +proxysql_mysql_threshold_query_length: 524288 +proxysql_mysql_threshold_resultset_size: 4194304 +proxysql_mysql_throttle_connections_per_sec_to_hostgroup: 1000000 +proxysql_mysql_throttle_max_bytes_per_second_to_client: 2147483647 +proxysql_mysql_throttle_ratio_server_to_client: 0 + +# session +proxysql_mysql_client_found_rows: true +proxysql_mysql_default_charset: utf8 +proxysql_mysql_default_query_delay: 0 +proxysql_mysql_default_query_timeout: 36000000 +proxysql_mysql_default_schema: information_schema +proxysql_mysql_default_sql_mode: +proxysql_mysql_default_time_zone: SYSTEM +proxysql_mysql_init_connect: +proxysql_mysql_max_allowed_packet: 4194304 +proxysql_mysql_max_transaction_time: 14400000 +proxysql_mysql_query_retries_on_failure: 1 +proxysql_mysql_server_capabilities: 45578 +proxysql_mysql_server_version: 5.5.30 +proxysql_mysql_mysql_wait_timeout: 28800000 +proxysql_mysql_kill_backend_connection_when_disconnect: true + +# ssl +proxysql_mysql_ssl_p2s_ca: +proxysql_mysql_ssl_p2s_cert: +proxysql_mysql_ssl_p2s_cipher: +proxysql_mysql_ssl_p2s_key: + +# query processing +proxysql_mysql_query_processor_iterations: 0 +proxysql_mysql_query_processor_regex: 1 + +# autocommit +proxysql_mysql_autocommit_false_is_transaction: false +proxysql_mysql_autocommit_false_not_reusable: false +proxysql_mysql_enforce_autocommit_on_reads: false +proxysql_mysql_forward_autocommit: false + +# prepared statements +proxysql_mysql_max_stmts_cache: 10000 +proxysql_mysql_max_stmts_per_connection: 20 + +# query cache +proxysql_mysql_query_cache_size_mb: 256 + +# mirroring +proxysql_mysql_mirror_max_concurrency: 16 +proxysql_mysql_mirror_max_queue_length: 32000 + +# monitor +proxysql_mysql_monitor_username: monitor +proxysql_mysql_monitor_password: monitor + +proxysql_mysql_monitor_connect_interval: 60000 +proxysql_mysql_monitor_connect_timeout: 600 +proxysql_mysql_monitor_enabled: true +proxysql_mysql_monitor_groupreplication_healthcheck_interval: 5000 +proxysql_mysql_monitor_groupreplication_healthcheck_timeout: 800 +proxysql_mysql_monitor_history: 600000 +proxysql_mysql_monitor_ping_interval: 10000 +proxysql_mysql_monitor_ping_max_failures: 3 +proxysql_mysql_monitor_ping_timeout: 1000 +proxysql_mysql_monitor_query_interval: 60000 +proxysql_mysql_monitor_query_timeout: 100 +proxysql_mysql_monitor_read_only_interval: 1500 +proxysql_mysql_monitor_read_only_max_timeout_count: 3 +proxysql_mysql_monitor_read_only_timeout: 500 +proxysql_mysql_monitor_replication_lag_interval: 10000 +proxysql_mysql_monitor_replication_lag_timeout: 1000 +proxysql_mysql_monitor_replication_lag_use_percona_heartbeat: +proxysql_mysql_monitor_slave_lag_when_null: 60 +proxysql_mysql_monitor_wait_timeout: true +proxysql_mysql_monitor_writer_is_also_reader: true + +# stats and logging +proxysql_mysql_commands_stats: true +proxysql_mysql_eventslog_filename: +proxysql_mysql_eventslog_filesize: 104857600 +proxysql_mysql_hostgroup_manager_verbose: 0 +proxysql_mysql_long_query_time: 1000 +proxysql_mysql_query_digests: true +proxysql_mysql_query_digests_lowercase: false +proxysql_mysql_query_digests_max_digest_length: 2048 +proxysql_mysql_query_digests_max_query_length: 65000 +proxysql_mysql_stats_time_backend_query: false +proxysql_mysql_stats_time_query_processor: false +proxysql_mysql_verbose_query_error: false diff --git a/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/handlers/main.yml b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/handlers/main.yml new file mode 100644 index 00000000..3ed9a13f --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/handlers/main.yml @@ -0,0 +1,33 @@ +--- +- name: proxysql | handler | manage admin config + proxysql_global_variables: + config_file: "~/.my.cnf" + variable: "admin-{{ item.value.variable }}" + value: "{{ item.value.variable_value }}" + loop: "{{ proxysql_admin_variables|dict2items }}" + listen: update proxysql config + +- name: proxysql | handler | manage mysql config + proxysql_global_variables: + config_file: "~/.my.cnf" + variable: "mysql-{{ item.value.variable }}" + value: "{{ item.value.variable_value }}" + loop: "{{ proxysql_mysql_variables|dict2items }}" + listen: update proxysql config + +- name: proxysql | handler | manage mysql options + proxysql_global_variables: + config_file: "~/.my.cnf" + variable: "mysql-{{ item.value.variable }}" + value: "{{ item.value.variable_value }}" + load_to_runtime: false + save_to_disk: true + loop: "{{ proxysql_mysql_options|dict2items }}" + listen: update proxysql config + +- name: proxysql | handler | restart proxysql + service: + name: proxysql + state: restarted + when: proxysql_force_restart + listen: restart proxysql diff --git a/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/meta/main.yml b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/meta/main.yml new file mode 100644 index 00000000..c0afeec9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/meta/main.yml @@ -0,0 +1,20 @@ +--- +galaxy_info: + author: Ben Mildren + description: Ansible role to install and configure ProxySQL + company: DigitalOcean + + license: license (BSD) + min_ansible_version: 2.9 + + platforms: + - name: Ubuntu + versions: + - xenial + - bionic + + galaxy_tags: + - proxysql + - mysql + +dependencies: [] diff --git a/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/molecule/default/converge.yml b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/molecule/default/converge.yml new file mode 100644 index 00000000..662cb235 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/molecule/default/converge.yml @@ -0,0 +1,5 @@ +--- +- name: Converge + hosts: all + roles: + - role: proxysql diff --git a/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/molecule/default/molecule.yml b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/molecule/default/molecule.yml new file mode 100644 index 00000000..c96fea7f --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/molecule/default/molecule.yml @@ -0,0 +1,46 @@ +--- +dependency: + name: galaxy +driver: + name: docker +lint: | + set -e + yamllint . + ansible-lint . + flake8 +platforms: + - name: test-proxysql-01 + image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu1804}-ansible:latest" + command: ${MOLECULE_DOCKER_COMMAND:-""} + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro + privileged: true + pre_build_image: true +provisioner: + name: ansible +scenario: + name: default + converge_sequence: + - dependency + - create + - prepare + - converge + test_sequence: + - lint + - destroy + - dependency + - syntax + - create + - prepare + - converge + - idempotence + # - side_effect + - verify + - destroy +verifier: + name: testinfra + env: + PYTHONWARNINGS: "ignore:.*U.*mode is deprecated:DeprecationWarning" + options: + # show which tests where executed in test output + v: 1 diff --git a/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/molecule/default/prepare.yml b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/molecule/default/prepare.yml new file mode 100644 index 00000000..07f52352 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/molecule/default/prepare.yml @@ -0,0 +1,20 @@ +--- +- name: Prepare + hosts: all + tasks: + - name: fix trusty image + block: + + - name: remove removed repo + file: + name: '/etc/apt/sources.list.d/jonathonf-python-2_7-trusty.list' + state: absent + + - name: install python-apt + apt: + name: + - python-apt + - python-pkg-resources=3.3-1ubuntu1 + state: present + + when: ansible_lsb.major_release|int == 14 diff --git a/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/molecule/default/tests/test_default.py b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/molecule/default/tests/test_default.py new file mode 100644 index 00000000..25a93c32 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/molecule/default/tests/test_default.py @@ -0,0 +1,81 @@ +import os +import pytest + +import testinfra.utils.ansible_runner + +testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( + os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') + + +def test_hosts_file(host): + f = host.file('/etc/hosts') + + assert f.exists + assert f.user == 'root' + assert f.group == 'root' + + +proxysql_user_attributes = ("user_name," + "group_name") + + +@pytest.mark.parametrize(proxysql_user_attributes, [ + ("proxysql", "proxysql"), +]) +def test_proxysql_users(host, + user_name, + group_name): + u = host.user(user_name) + + assert u.exists + assert u.group == group_name + + +proxysql_file_attributes = ("proxysql_file," + "proxysql_file_user," + "proxysql_file_group," + "proxysql_file_mode") + + +@pytest.mark.parametrize(proxysql_file_attributes, [ + ("/root/.my.cnf", None, None, 0o600), + ("/etc/proxysql.cnf", "proxysql", "proxysql", 0o644), +]) +def test_proxysql_files(host, + proxysql_file, + proxysql_file_user, + proxysql_file_group, + proxysql_file_mode): + f = host.file(proxysql_file) + + assert f.exists + assert f.is_file + if proxysql_file_user: + assert f.user == proxysql_file_user + if proxysql_file_group: + assert f.group == proxysql_file_group + if proxysql_file_mode: + assert f.mode == proxysql_file_mode + + +@pytest.mark.parametrize("proxysql_package", [ + ("percona-server-client-5.7"), + ("proxysql"), +]) +def test_proxysql_packages(host, + proxysql_package): + + pkg = host.package(proxysql_package) + + assert pkg.is_installed + + +@pytest.mark.parametrize("proxysql_service", [ + ("proxysql"), +]) +def test_proxysql_services(host, + proxysql_service): + svc = host.service(proxysql_service) + + assert svc.is_enabled + assert svc.is_running diff --git a/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/tasks/config.yml b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/tasks/config.yml new file mode 100644 index 00000000..db7038f9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/tasks/config.yml @@ -0,0 +1,32 @@ +--- +- name: proxysql | config | copy client my.cnf + template: + src: client.my.cnf.j2 + dest: ~/.my.cnf + mode: 0600 + +- name: proxysql | config | copy proxysql config + template: + src: proxysql.cnf.j2 + dest: /etc/proxysql.cnf + owner: "{{ proxysql_user }}" + group: "{{ proxysql_group }}" + mode: 0644 + notify: + - update proxysql config + - restart proxysql + +- name: proxysql | config | enable and start proxysql + service: + name: proxysql + state: started + enabled: true + +- name: proxysql | config | wait for proxysql + wait_for: + port: "{{ proxysql_admin_port }}" + state: started + timeout: 30 + +- name: proxysql | config | update dynamic config + meta: flush_handlers diff --git a/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/tasks/install.yml b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/tasks/install.yml new file mode 100644 index 00000000..538841aa --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/tasks/install.yml @@ -0,0 +1,90 @@ +--- +- name: proxysql | install | update apt cache + apt: + cache_valid_time: 14400 + changed_when: false + ignore_errors: "{{ ansible_check_mode }}" + +- name: proxysql | install | install (trusty specific) + block: + + - name: proxysql | install | install platform specific prereqs + apt: + name: "{{ lookup('vars', 'proxysql_' + ansible_lsb.codename + '_prereqs') }}" + state: present + environment: + DEBIAN_FRONTEND: noninteractive + + rescue: + + - name: proxysql | install | handle the error if we failed in check mode, with python-apt uninstalled + assert: + that: ansible_failed_result.msg is match("python-apt must be installed to use check mode.*") + fail_msg: "unknown error during package install" + success_msg: "running in check mode without python-apt installed, ignoring error" + + when: ansible_lsb.major_release|int == 14 + + +- name: proxysql | install | install + block: + + - name: proxysql | install | install platform specific prereqs + apt: + name: "{{ proxysql_prereqs }}" + state: present + environment: + DEBIAN_FRONTEND: noninteractive + + - name: proxysql | install | install python packages + pip: + name: "{{ proxysql_python_packages }}" + executable: pip3 + + rescue: + + - name: proxysql | install | handle the error if we failed in check mode, with python-apt uninstalled + assert: + that: ansible_failed_result.msg is match("python-apt must be installed to use check mode.*") + fail_msg: "unknown error during package install" + success_msg: "running in check mode without python-apt installed, ignoring error" + + when: ansible_lsb.major_release|int > 14 + +- name: proxysql | install | install + block: + + - name: proxysql | install | add apt signing key for percona + apt_key: + keyserver: keyserver.ubuntu.com + id: 4D1BB29D63D98E422B2113B19334A25F8507EFA5 + state: present + + + - name: proxysql | install | add percona repositories + apt_repository: + repo: "{{ item }}" + state: present + loop: "{{ percona_mysql_repos }}" + + - name: proxysql | install | install packages required by proxysql + apt: + name: "{{ proxysql_additional_packages }}" + state: present + environment: + DEBIAN_FRONTEND: noninteractive + + - name: proxysql | install | install proxysql release + apt: + deb: "{{ proxysql_release }}" + state: present + notify: + - restart proxysql + + rescue: + + - name: proxysql | install | handle the error if we failed in check mode, with python-apt uninstalled + assert: + that: ansible_failed_result is search("python-apt must be installed to use check mode") + fail_msg: "unknown error during package install" + success_msg: "running in check mode without python-apt installed, ignoring error" diff --git a/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/tasks/main.yml b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/tasks/main.yml new file mode 100644 index 00000000..9836f366 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/tasks/main.yml @@ -0,0 +1,22 @@ +--- +- import_tasks: setvars.yml + tags: + - always + +- block: + + - import_tasks: users.yml + tags: + - users + - config + - import_tasks: install.yml + when: not proxysql_mysql_use_custom_build + tags: + - install + + become: true + become_user: root + +- import_tasks: config.yml + tags: + - config diff --git a/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/tasks/setvars.yml b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/tasks/setvars.yml new file mode 100644 index 00000000..fe26b488 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/tasks/setvars.yml @@ -0,0 +1,8 @@ +--- +- name: proxysql | setvars | set users + set_fact: + admin_credentials_list: "{{ admin_credentials_list | default([]) + [ item.username + ':' + item.password ] }}" + loop: + - { username: "{{ proxysql_admin_user }}", password: "{{ proxysql_admin_password }}" } + - { username: "{{ proxysql_admin_cluster_username }}", password: "{{ proxysql_admin_cluster_password }}" } + when: item.username and item.password diff --git a/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/tasks/users.yml b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/tasks/users.yml new file mode 100644 index 00000000..eb8ea675 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/tasks/users.yml @@ -0,0 +1,16 @@ +--- +- name: proxysql | users | create group for proxysql + group: + name: "{{ proxysql_group }}" + system: true + state: present + +- name: proxysql | users | create user for proxysql + user: + name: "{{ proxysql_user }}" + system: true + group: "{{ proxysql_group }}" + comment: "Proxysql Service" + home: "{{ proxysql_datadir }}" + shell: /usr/sbin/nologin + state: present diff --git a/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/templates/client.my.cnf.j2 b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/templates/client.my.cnf.j2 new file mode 100644 index 00000000..12d44d53 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/templates/client.my.cnf.j2 @@ -0,0 +1,6 @@ +### {{ ansible_managed }} +[client] +user=admin +password=admin +host={{ proxysql_admin_bind_address }} +port={{ proxysql_admin_port }} diff --git a/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/templates/proxysql.cnf.j2 b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/templates/proxysql.cnf.j2 new file mode 100644 index 00000000..28ce54c6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/templates/proxysql.cnf.j2 @@ -0,0 +1,21 @@ +#jinja2: lstrip_blocks: "true" +datadir="{{ proxysql_datadir }}" +restart_on_missing_heartbeats={{ proxysql_restart_missing_heartbeats }} + +admin_variables= +{ +{% for config_item in proxysql_admin_variables|dictsort %} + {% if config_item.1.variable_value is not none %} + {{ config_item.1.variable }}={{ config_item.1.variable_value | to_json }} + {% endif %} +{% endfor %} +} + +mysql_variables= +{ +{% for config_item in proxysql_mysql_variables|dictsort %} + {% if config_item.1.variable_value is not none %} + {{ config_item.1.variable }}={{ config_item.1.variable_value | to_json }} + {% endif %} +{% endfor %} +} diff --git a/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/vars/main.yml b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/vars/main.yml new file mode 100644 index 00000000..ffc02dc8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/community/proxysql/roles/proxysql/vars/main.yml @@ -0,0 +1,385 @@ +--- +### percona repo +percona_mysql_repos: + - deb http://repo.percona.com/apt {{ ansible_lsb.codename }} main + - deb-src http://repo.percona.com/apt {{ ansible_lsb.codename }} main + +### platform specific packages +proxysql_trusty_prereqs: + - libgnutls28-dev + +proxysql_prereqs: + - dirmngr + - python-setuptools + - python3-pip + - python3-virtualenv + +### proxysql required packages +proxysql_release: "{{ proxysql_download_src }}/v{{ proxysql_version }}/proxysql_{{ proxysql_version }}-{{ ansible_lsb.id | lower }}{{ ansible_lsb.major_release }}_amd64.deb" + +proxysql_additional_packages: + - percona-server-client-{{ proxysql_mysql_client_version }} + - python-mysqldb + +proxysql_python_packages: + - pymysql + +proxysql_admin_variables: + admin_credentials: + variable: "admin_credentials" + variable_value: "{{ admin_credentials_list | join(';') }}" + checksum_mysql_query_rules: + variable: "checksum_mysql_query_rules" + variable_value: "{{ proxysql_admin_checksum_mysql_query_rules | to_json }}" + checksum_mysql_servers: + variable: "checksum_mysql_servers" + variable_value: "{{ proxysql_admin_checksum_mysql_servers | to_json }}" + checksum_mysql_users: + variable: "checksum_mysql_users" + variable_value: "{{ proxysql_admin_checksum_mysql_users | to_json }}" + cluster_check_interval_ms: + variable: "cluster_check_interval_ms" + variable_value: "{{ proxysql_admin_cluster_check_interval_ms }}" + cluster_check_status_frequency: + variable: "cluster_check_status_frequency" + variable_value: "{{ proxysql_admin_cluster_check_status_frequency }}" + cluster_mysql_query_rules_diffs_before_sync: + variable: "cluster_mysql_query_rules_diffs_before_sync" + variable_value: "{{ proxysql_admin_cluster_mysql_query_rules_diffs_before_sync }}" + cluster_mysql_query_rules_save_to_disk: + variable: "cluster_mysql_query_rules_save_to_disk" + variable_value: "{{ proxysql_admin_cluster_mysql_query_rules_save_to_disk | to_json }}" + cluster_mysql_servers_diffs_before_sync: + variable: "cluster_mysql_servers_diffs_before_sync" + variable_value: "{{ proxysql_admin_cluster_mysql_servers_diffs_before_sync }}" + cluster_mysql_servers_save_to_disk: + variable: "cluster_mysql_servers_save_to_disk" + variable_value: "{{ proxysql_admin_cluster_mysql_servers_save_to_disk | to_json }}" + cluster_mysql_users_diffs_before_sync: + variable: "cluster_mysql_users_diffs_before_sync" + variable_value: "{{ proxysql_admin_cluster_mysql_users_diffs_before_sync }}" + cluster_mysql_users_save_to_disk: + variable: "cluster_mysql_users_save_to_disk" + variable_value: "{{ proxysql_admin_cluster_mysql_users_save_to_disk | to_json }}" + cluster_proxysql_servers_diffs_before_sync: + variable: "cluster_proxysql_servers_diffs_before_sync" + variable_value: "{{ proxysql_admin_cluster_proxysql_servers_diffs_before_sync }}" + cluster_proxysql_servers_save_to_disk: + variable: "cluster_proxysql_servers_save_to_disk" + variable_value: "{{ proxysql_admin_cluster_proxysql_servers_save_to_disk | to_json }}" + hash_passwords: + variable: "hash_passwords" + variable_value: "{{ proxysql_admin_hash_passwords | to_json }}" + mysql_ifaces: + variable: "mysql_ifaces" + variable_value: "{{ proxysql_admin_bind_address }}:{{ proxysql_admin_port }};{{ proxysql_admin_socket }}" + read_only: + variable: "read_only" + variable_value: "{{ proxysql_admin_read_only | to_json }}" + refresh_interval: + variable: "refresh_interval" + variable_value: "{{ proxysql_admin_refresh_interval }}" + stats_credentials: + variable: "stats_credentials" + variable_value: "{{ proxysql_admin_stats_user }}:{{ proxysql_admin_stats_password }}" + stats_mysql_connection_pool: + variable: "stats_mysql_connection_pool" + variable_value: "{{ proxysql_admin_stats_mysql_connection_pool }}" + stats_mysql_connections: + variable: "stats_mysql_connections" + variable_value: "{{ proxysql_admin_stats_mysql_connections }}" + stats_mysql_query_cache: + variable: "stats_mysql_query_cache" + variable_value: "{{ proxysql_admin_stats_mysql_query_cache }}" + stats_system_cpu: + variable: "stats_system_cpu" + variable_value: "{{ proxysql_admin_stats_system_cpu }}" + stats_system_memory: + variable: "stats_system_memory" + variable_value: "{{ proxysql_admin_stats_system_memory }}" + web_enabled: + variable: "web_enabled" + variable_value: "{{ proxysql_admin_web_enabled | to_json }}" + web_port: + variable: "web_port" + variable_value: "{{ proxysql_admin_web_port }}" + +proxysql_mysql_variables: + autocommit_false_is_transaction: + variable: "autocommit_false_is_transaction" + variable_value: "{{ proxysql_mysql_autocommit_false_is_transaction | to_json }}" + autocommit_false_not_reusable: + variable: "autocommit_false_not_reusable" + variable_value: "{{ proxysql_mysql_autocommit_false_not_reusable | to_json }}" + client_found_rows: + variable: "client_found_rows" + variable_value: "{{ proxysql_mysql_client_found_rows | to_json }}" + commands_stats: + variable: "commands_stats" + variable_value: "{{ proxysql_mysql_commands_stats | to_json }}" + connect_retries_delay: + variable: "connect_retries_delay" + variable_value: "{{ proxysql_mysql_connect_retries_delay }}" + connect_retries_on_failure: + variable: "connect_retries_on_failure" + variable_value: "{{ proxysql_mysql_connect_retries_on_failure }}" + connect_timeout_server: + variable: "connect_timeout_server" + variable_value: "{{ proxysql_mysql_connect_timeout_server }}" + connect_timeout_server_max: + variable: "connect_timeout_server_max" + variable_value: "{{ proxysql_mysql_connect_timeout_server_max }}" + connection_delay_multiplex_ms: + variable: "connection_delay_multiplex_ms" + variable_value: "{{ proxysql_mysql_connection_delay_multiplex_ms }}" + connection_max_age_ms: + variable: "connection_max_age_ms" + variable_value: "{{ proxysql_mysql_connection_max_age_ms }}" + connpoll_reset_queue_length: + variable: "connpoll_reset_queue_length" + variable_value: "{{ proxysql_mysql_connpoll_reset_queue_length }}" + default_charset: + variable: "default_charset" + variable_value: "{{ proxysql_mysql_default_charset }}" + default_max_latency_ms: + variable: "default_max_latency_ms" + variable_value: "{{ proxysql_mysql_default_max_latency_ms }}" + default_query_delay: + variable: "default_query_delay" + variable_value: "{{ proxysql_mysql_default_query_delay }}" + default_query_timeout: + variable: "default_query_timeout" + variable_value: "{{ proxysql_mysql_default_query_timeout }}" + default_schema: + variable: "default_schema" + variable_value: "{{ proxysql_mysql_default_schema }}" + default_sql_mode: + variable: "default_sql_mode" + variable_value: "{{ proxysql_mysql_default_sql_mode }}" + default_time_zone: + variable: "default_time_zone" + variable_value: "{{ proxysql_mysql_default_time_zone }}" + eventslog_filename: + variable: "eventslog_filename" + variable_value: "{{ proxysql_mysql_eventslog_filename }}" + eventslog_filesize: + variable: "eventslog_filesize" + variable_value: "{{ proxysql_mysql_eventslog_filesize }}" + enforce_autocommit_on_reads: + variable: "enforce_autocommit_on_reads" + variable_value: "{{ proxysql_mysql_enforce_autocommit_on_reads | to_json}}" + forward_autocommit: + variable: "forward_autocommit" + variable_value: "{{ proxysql_mysql_forward_autocommit | to_json}}" + free_connections_pct: + variable: "free_connections_pct" + variable_value: "{{ proxysql_mysql_free_connections_pct }}" + hostgroup_manager_verbose: + variable: "hostgroup_manager_verbose" + variable_value: "{{ proxysql_mysql_hostgroup_manager_verbose }}" + init_connect: + variable: "init_connect" + variable_value: "{{ proxysql_mysql_init_connect }}" + kill_backend_connection_when_disconnect: + variable: "kill_backend_connection_when_disconnect" + variable_value: "{{ proxysql_mysql_kill_backend_connection_when_disconnect | to_json }}" + long_query_time: + variable: "long_query_time" + variable_value: "{{ proxysql_mysql_long_query_time }}" + max_allowed_packet: + variable: "max_allowed_packet" + variable_value: "{{ proxysql_mysql_max_allowed_packet }}" + max_connections: + variable: "max_connections" + variable_value: "{{ proxysql_mysql_max_connections }}" + max_stmts_cache: + variable: "max_stmts_cache" + variable_value: "{{ proxysql_mysql_max_stmts_cache }}" + max_stmts_per_connection: + variable: "max_stmts_per_connection" + variable_value: "{{ proxysql_mysql_max_stmts_per_connection }}" + max_transaction_time: + variable: "max_transaction_time" + variable_value: "{{ proxysql_mysql_max_transaction_time }}" + mirror_max_concurrency: + variable: "mirror_max_concurrency" + variable_value: "{{ proxysql_mysql_mirror_max_concurrency }}" + mirror_max_queue_length: + variable: "mirror_max_queue_length" + variable_value: "{{ proxysql_mysql_mirror_max_queue_length }}" + monitor_connect_interval: + variable: "monitor_connect_interval" + variable_value: "{{ proxysql_mysql_monitor_connect_interval }}" + monitor_connect_timeout: + variable: "monitor_connect_timeout" + variable_value: "{{ proxysql_mysql_monitor_connect_timeout }}" + monitor_enabled: + variable: "monitor_enabled" + variable_value: "{{ proxysql_mysql_monitor_enabled | to_json }}" + monitor_groupreplication_healthcheck_interval: + variable: "monitor_groupreplication_healthcheck_interval" + variable_value: "{{ proxysql_mysql_monitor_groupreplication_healthcheck_interval }}" + monitor_groupreplication_healthcheck_timeout: + variable: "monitor_groupreplication_healthcheck_timeout" + variable_value: "{{ proxysql_mysql_monitor_groupreplication_healthcheck_timeout }}" + monitor_history: + variable: "monitor_history" + variable_value: "{{ proxysql_mysql_monitor_history }}" + monitor_password: + variable: "monitor_password" + variable_value: "{{ proxysql_mysql_monitor_password }}" + monitor_ping_interval: + variable: "monitor_ping_interval" + variable_value: "{{ proxysql_mysql_monitor_ping_interval }}" + monitor_ping_max_failures: + variable: "monitor_ping_max_failures" + variable_value: "{{ proxysql_mysql_monitor_ping_max_failures }}" + monitor_ping_timeout: + variable: "monitor_ping_timeout" + variable_value: "{{ proxysql_mysql_monitor_ping_timeout }}" + monitor_query_interval: + variable: "monitor_query_interval" + variable_value: "{{ proxysql_mysql_monitor_query_interval }}" + monitor_query_timeout: + variable: "monitor_query_timeout" + variable_value: "{{ proxysql_mysql_monitor_query_timeout }}" + monitor_read_only_interval: + variable: "monitor_read_only_interval" + variable_value: "{{ proxysql_mysql_monitor_read_only_interval }}" + monitor_read_only_max_timeout_count: + variable: "monitor_read_only_max_timeout_count" + variable_value: "{{ proxysql_mysql_monitor_read_only_max_timeout_count }}" + monitor_read_only_timeout: + variable: "monitor_read_only_timeout" + variable_value: "{{ proxysql_mysql_monitor_read_only_timeout }}" + monitor_replication_lag_interval: + variable: "monitor_replication_lag_interval" + variable_value: "{{ proxysql_mysql_monitor_replication_lag_interval }}" + monitor_replication_lag_timeout: + variable: "monitor_replication_lag_timeout" + variable_value: "{{ proxysql_mysql_monitor_replication_lag_timeout }}" + monitor_replication_lag_use_percona_heartbeat: + variable: "monitor_replication_lag_use_percona_heartbeat" + variable_value: "{{ proxysql_mysql_monitor_replication_lag_use_percona_heartbeat }}" + monitor_slave_lag_when_null: + variable: "monitor_slave_lag_when_null" + variable_value: "{{ proxysql_mysql_monitor_slave_lag_when_null }}" + monitor_username: + variable: "monitor_username" + variable_value: "{{ proxysql_mysql_monitor_username }}" + monitor_wait_timeout: + variable: "monitor_wait_timeout" + variable_value: "{{ proxysql_mysql_monitor_wait_timeout | to_json }}" + monitor_writer_is_also_reader: + variable: "monitor_writer_is_also_reader" + variable_value: "{{ proxysql_mysql_monitor_writer_is_also_reader | to_json }}" + multiplexing: + variable: "multiplexing" + variable_value: "{{ proxysql_mysql_multiplexing | to_json }}" + mysql_interfaces: + variable: "interfaces" + variable_value: "{{ proxysql_mysql_bind_address }}:{{ proxysql_mysql_port }};{{ proxysql_mysql_socket }}" + ping_interval_server_msec: + variable: "ping_interval_server_msec" + variable_value: "{{ proxysql_mysql_ping_interval_server_msec }}" + ping_timeout_server: + variable: "ping_timeout_server" + variable_value: "{{ proxysql_mysql_ping_timeout_server }}" + poll_timeout: + variable: "poll_timeout" + variable_value: "{{ proxysql_mysql_poll_timeout }}" + poll_timeout_on_failure: + variable: "poll_timeout_on_failure" + variable_value: "{{ proxysql_mysql_poll_timeout_on_failure }}" + query_cache_size_mb: + variable: "query_cache_size_MB" + variable_value: "{{ proxysql_mysql_query_cache_size_mb }}" + query_digests: + variable: "query_digests" + variable_value: "{{ proxysql_mysql_query_digests | to_json }}" + query_digests_lowercase: + variable: "query_digests_lowercase" + variable_value: "{{ proxysql_mysql_query_digests_lowercase | to_json }}" + query_digests_max_digest_length: + variable: "query_digests_max_digest_length" + variable_value: "{{ proxysql_mysql_query_digests_max_digest_length }}" + query_digests_max_query_length: + variable: "query_digests_max_query_length" + variable_value: "{{ proxysql_mysql_query_digests_max_query_length }}" + query_processor_iterations: + variable: "query_processor_iterations" + variable_value: "{{ proxysql_mysql_query_processor_iterations }}" + query_processor_regex: + variable: "query_processor_regex" + variable_value: "{{ proxysql_mysql_query_processor_regex }}" + query_retries_on_failure: + variable: "query_retries_on_failure" + variable_value: "{{ proxysql_mysql_query_retries_on_failure }}" + server_capabilities: + variable: "server_capabilities" + variable_value: "{{ proxysql_mysql_server_capabilities }}" + server_version: + variable: "server_version" + variable_value: "{{ proxysql_mysql_server_version }}" + session_idle_ms: + variable: "session_idle_ms" + variable_value: "{{ proxysql_mysql_session_idle_ms }}" + session_idle_show_processlist: + variable: "session_idle_show_processlist" + variable_value: "{{ proxysql_mysql_session_idle_show_processlist | to_json }}" + sessions_sort: + variable: "sessions_sort" + variable_value: "{{ proxysql_mysql_sessions_sort | to_json }}" + shun_on_failures: + variable: "shun_on_failures" + variable_value: "{{ proxysql_mysql_shun_on_failures }}" + shun_recovery_time_sec: + variable: "shun_recovery_time_sec" + variable_value: "{{ proxysql_mysql_shun_recovery_time_sec }}" + ssl_p2s_ca: + variable: "ssl_p2s_ca" + variable_value: "{{ proxysql_mysql_ssl_p2s_ca }}" + ssl_p2s_cert: + variable: "ssl_p2s_cert" + variable_value: "{{ proxysql_mysql_ssl_p2s_cert }}" + ssl_p2s_cipher: + variable: "ssl_p2s_cipher" + variable_value: "{{ proxysql_mysql_ssl_p2s_cipher }}" + ssl_p2s_key: + variable: "ssl_p2s_key" + variable_value: "{{ proxysql_mysql_ssl_p2s_key }}" + stats_time_backend_query: + variable: "stats_time_backend_query" + variable_value: "{{ proxysql_mysql_stats_time_backend_query | to_json }}" + stats_time_query_processor: + variable: "stats_time_query_processor" + variable_value: "{{ proxysql_mysql_stats_time_query_processor | to_json }}" + threshold_query_length: + variable: "threshold_query_length" + variable_value: "{{ proxysql_mysql_threshold_query_length }}" + threshold_resultset_size: + variable: "threshold_resultset_size" + variable_value: "{{ proxysql_mysql_threshold_resultset_size }}" + throttle_connections_per_sec_to_hostgroup: + variable: "throttle_connections_per_sec_to_hostgroup" + variable_value: "{{ proxysql_mysql_throttle_connections_per_sec_to_hostgroup }}" + throttle_max_bytes_per_second_to_client: + variable: "throttle_max_bytes_per_second_to_client" + variable_value: "{{ proxysql_mysql_throttle_max_bytes_per_second_to_client }}" + throttle_ratio_server_to_client: + variable: "throttle_ratio_server_to_client" + variable_value: "{{ proxysql_mysql_throttle_ratio_server_to_client }}" + verbose_query_error: + variable: "verbose_query_error" + variable_value: "{{ proxysql_mysql_verbose_query_error | to_json }}" + wait_timeout: + variable: "wait_timeout" + variable_value: "{{ proxysql_mysql_mysql_wait_timeout }}" + +proxysql_mysql_options: + mysql_threads: + variable: "threads" + variable_value: "{{ proxysql_mysql_threads }}" + mysql_stacksize: + variable: "stacksize" + variable_value: "{{ proxysql_mysql_stacksize }}" |