Conditional mysql/mariadb
This commit is contained in:
parent
ffbda7abbb
commit
a7d4d8925d
12
mysql.cf
12
mysql.cf
|
@ -10,17 +10,20 @@ vars:
|
||||||
"bind_address":"127.0.0.1",
|
"bind_address":"127.0.0.1",
|
||||||
"user":"mysql",
|
"user":"mysql",
|
||||||
"port":"3306",
|
"port":"3306",
|
||||||
"backup_dir":"/var/backups"
|
"backup_dir":"/var/backups",
|
||||||
|
"mariadb":true
|
||||||
}';
|
}';
|
||||||
|
|
||||||
"cfg" data => mergedata(@(default_cfg),@(cfg_param));
|
"cfg" data => mergedata(@(default_cfg),@(cfg_param));
|
||||||
|
|
||||||
freebsd::
|
freebsd::
|
||||||
"user" string => "mysql";
|
"user" string => "mysql";
|
||||||
# "server_pkgs" slist => {"mariadb106-server"};
|
|
||||||
# "client_pkgs" slist => {"mariadb106-client"};
|
|
||||||
"server_pkgs" slist => {"mysql80-server"};
|
"server_pkgs" slist => {"mysql80-server"};
|
||||||
"client_pkgs" slist => {"mysql80-client"};
|
"client_pkgs" slist => {"mysql80-client"};
|
||||||
|
|
||||||
|
"server_pkgs" slist => {"mariadb106-server"}, if => strcmp("$(cfg[mariadb])","true");
|
||||||
|
"client_pkgs" slist => {"mariadb106-client"}, if => strcmp("$(cfg[mariadb])","true");
|
||||||
|
|
||||||
"type" string => "mysql8";
|
"type" string => "mysql8";
|
||||||
"service_name" string => "mysql-server";
|
"service_name" string => "mysql-server";
|
||||||
"cfg_dir" string => "/usr/local/etc/mysql";
|
"cfg_dir" string => "/usr/local/etc/mysql";
|
||||||
|
@ -373,6 +376,7 @@ $(cron) root $(table_exists_cmd) && $(backup_cmd)
|
||||||
bundle agent create_mysql_db(cfg)
|
bundle agent create_mysql_db(cfg)
|
||||||
{
|
{
|
||||||
classes:
|
classes:
|
||||||
|
|
||||||
"type_$(mysql.type)" ;
|
"type_$(mysql.type)" ;
|
||||||
# "do_restore" expression => isvariable("cfg[restore]");
|
# "do_restore" expression => isvariable("cfg[restore]");
|
||||||
"do_restore" expression => strcmp("$(cfg[db_restore])","true");
|
"do_restore" expression => strcmp("$(cfg[db_restore])","true");
|
||||||
|
@ -384,6 +388,8 @@ vars:
|
||||||
"db_pass" string => "$(cfg[db_pass])";
|
"db_pass" string => "$(cfg[db_pass])";
|
||||||
|
|
||||||
|
|
||||||
|
"args" string => "pnunf";
|
||||||
|
|
||||||
type_mariadb::
|
type_mariadb::
|
||||||
"args" string => "-e \"CREATE DATABASE IF NOT EXISTS $(db_name); GRANT ALL PRIVILEGES ON $(db_name).* TO '$(db_user)'@'$(host)' IDENTIFIED BY '$(db_pass)'; \" ";
|
"args" string => "-e \"CREATE DATABASE IF NOT EXISTS $(db_name); GRANT ALL PRIVILEGES ON $(db_name).* TO '$(db_user)'@'$(host)' IDENTIFIED BY '$(db_pass)'; \" ";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue