Default cfg and correct perms for /etc/mysql

This commit is contained in:
Tobias Herre 2023-10-13 20:09:33 +02:00
parent 1e20758f51
commit a6a149a156
1 changed files with 18 additions and 12 deletions

View File

@ -2,31 +2,36 @@
# #
# #
bundle agent mysql bundle agent mysql(cfg_param)
{ {
vars: vars:
"bind_address" string => "127.0.0.1"; "default_cfg" data => '{
"user" string => "mysql"; "bind_address":"127.0.0.1",
"port" string => "3306"; "user":"mysql",
"port":"3306"
}';
"cfg" data => mergedata(@(default_cfg),@(cfg_param));
freebsd:: freebsd::
# "pkg" string => "mariadb106-server"; # "pkg" string => "mariadb106-server";
"pkg" string => "mysql80-server"; "pkg" string => "mysql80-server";
"service_name" string => "mysql-server"; "service_name" string => "mysql-server";
"cfg_dir" string => "/usr/local/etc/mysql";
"cfg_file" string => "/usr/local/etc/mysql/my.cnf"; "cfg_file" string => "/usr/local/etc/mysql/my.cnf";
"mysql_cmd" string => "/usr/local/bin/mysql"; "mysql_cmd" string => "/usr/local/bin/mysql";
debian:: debian::
"pkg" slist => {"mariadb-common", "mariadb-client", "mariadb-server"}; "pkg" slist => {"mariadb-server"};
"service_name" string => "mysql"; "service_name" string => "mysql";
"cfg_dir" string => "/etc/mysql";
"cfg_file" string => "/etc/mysql/my.cnf"; "cfg_file" string => "/etc/mysql/my.cnf";
"mysql_cmd" string => "/usr/bin/mysql"; "mysql_cmd" string => "/usr/bin/mysql";
commands:
# debian&mysql_repaired::
# "/usr/bin/mysql_install_db"
# depends_on => { "mysql_pkgs_installed" },
# handle => "mysql_db_installed";
files: files:
"$(cfg_dir)/."
create => "true",
perms => mog("0755","root","root"),
handle => "mysql_cfg_dir_created";
"$(cfg_file)" "$(cfg_file)"
create => "true", create => "true",
@ -34,7 +39,7 @@ files:
edit_template => "$(sys.workdir)/inputs/$(def.wmde_libdir)/templates/my.cnf.mustache", edit_template => "$(sys.workdir)/inputs/$(def.wmde_libdir)/templates/my.cnf.mustache",
template_method => "mustache", template_method => "mustache",
handle => "mysql_cfg_created", handle => "mysql_cfg_created",
# depends_on => {"mysql_db_installed"}, depends_on => {"mysql_cfg_dir_created"},
classes => if_repaired("mysql_repaired"); classes => if_repaired("mysql_repaired");
@ -53,6 +58,7 @@ services:
service_policy => "restart", service_policy => "restart",
depends_on => {"mysql_running","mysql_cfg_created"}; depends_on => {"mysql_running","mysql_cfg_created"};
reports:
} }