Initializes DB

This commit is contained in:
Tobias Herre 2023-10-23 01:48:08 +02:00
parent ba31a7cfa3
commit 177ab077e3
1 changed files with 25 additions and 2 deletions

View File

@ -5,6 +5,7 @@
bundle agent mysql(cfg_param)
{
vars:
"default_cfg" data => '{
"bind_address":"127.0.0.1",
"user":"mysql",
@ -14,6 +15,7 @@ vars:
"cfg" data => mergedata(@(default_cfg),@(cfg_param));
freebsd::
"user" string => "mysql";
# "server_pkgs" slist => {"mariadb106-server"};
# "client_pkgs" slist => {"mariadb106-client"};
"server_pkgs" slist => {"mysql80-server"};
@ -23,7 +25,11 @@ vars:
"cfg_dir" string => "/usr/local/etc/mysql";
"cfg_file" string => "/usr/local/etc/mysql/my.cnf";
"bin_dir" string => "/usr/local/bin";
"install_db_cmd" string => "$(bin_dir)/mariadb-install-db --user=$(user) > /dev/null";
"default_datadir" string => "/var/db/mysql";
debian::
"user" string => "mysql";
"server_pkgs" slist => {"mariadb-server"};
"client_pkgs" slist => {"mariadb-client"};
"type" string => "mariadb";
@ -31,17 +37,27 @@ vars:
"cfg_dir" string => "/etc/mysql";
"cfg_file" string => "/etc/mysql/my.cnf";
"bin_dir" string => "/usr/bin";
"install_db_cmd" string => "$(bin_dir)/mariadb-install-db --user=$(user) > /dev/null ";
"default_datadir" string => "/var/lib/mysql";
fedora::
"user" string => "mysql";
"server_pkgs" slist => {"mariadb-server"};
"client_pkgs" slist => {"mariadb-client"};
"type" string => "mariadb";
"service_name" string => "mariadb";
"cfg_dir" string => "/etc/mysql";
"cfg_file" string => "/etc/my.cnf";
"bin_dir" string => "/usr/bin"; any::
"bin_dir" string => "/usr/bin";
"install_db_cmd" string => "$(bin_dir)/mariadb-install-db --user=$(user) > /dev/null";
"default_datadir" string => "/var/lib/mysql";
any::
"mysql_cmd" string => "$(bin_dir)/mysql";
"mysqldump_cmd" string => "$(bin_dir)/mysqldump";
"datadir" string => ifelse(isvariable("cfg[settings][mysqld][datadir]"),
"$(cfg[settings][mysqld][datadir])",
"$(default_datadir)");
files:
freebsd::
@ -108,9 +124,16 @@ files:
handle => "myslq_server_cfg_edited",
classes => if_repaired("mysql_server_repaired");
commands:
"$(mysql.install_db_cmd)"
handle=>"mysql_datadir_initialized",
contain => wmde_cmd_useshell,
inform => "false",
depends_on => {"myslq_server_cfg_edited"};
methods:
"any" usebundle => wmde_service("$(mysql.service_name)","mysql_server_kept","mysql_server_repaired"),
depends_on => {"myslq_server_cfg_edited"};
depends_on => {"mysql_datadir_initialized"};
reports: