UPDATE global_variables SET variable_value='admin:AdminStrongPassword' WHERE variable_name='admin-admin_credentials';
LOAD ADMIN VARIABLES TO RUNTIME;
SAVE ADMIN VARIABLES TO DISK;
{%for host in groups['db_servers']%}
  {% if loop.index == 1 %}
INSERT INTO mysql_servers(hostgroup_id,hostname,port,weight,comment) VALUES (10,'{{ hostvars[host]['ansible_host'] }}',3306,1000000,'WRITE');
  {% else %}
INSERT INTO mysql_servers(hostgroup_id,hostname,port,weight,comment) VALUES (11,'{{ hostvars[host]['ansible_host'] }}',3306,1000,'READ');
  {% endif %}
{% endfor %}
LOAD mysql servers TO RUNTIME;
SAVE mysql servers TO DISK;
INSERT INTO mysql_query_rules(rule_id,active,match_pattern,destination_hostgroup,apply) VALUES (1,1,'^SELECT.*FOR UPDATE$',10,1), (2,1,'^SELECT',11,1);
LOAD MYSQL query rules TO RUNTIME;
SAVE MYSQL query rules TO DISK;
INSERT INTO mysql_users(username,password,default_hostgroup) VALUES ('nextcloudb','secret',10);
LOAD mysql users TO RUNTIME;
SAVE mysql users TO DISK;
UPDATE global_variables SET variable_value='monitor' WHERE variable_name='mysql-monitor_username';
UPDATE global_variables SET variable_value='MonitoringPassword' WHERE variable_name='mysql-monitor_password';
LOAD MYSQL VARIABLES TO RUNTIME;
SAVE MYSQL VARIABLES TO DISK;
INSERT INTO scheduler(active,interval_ms,filename,arg1,comment) VALUES (1,10000,'/var/lib/proxysql/proxysql_galera_checker','--config-file=/etc/proxysql-admin.cnf --write-hg=10 --read-hg=11 --writer-count=1 --mode=singlewrite --log=/var/lib/proxysql/proxysql_galera_checker.log', 'gaclunc');
LOAD SCHEDULER TO RUNTIME;
SAVE SCHEDULER TO DISK;
