From a6a149a1569e5023ae92a168b99ff553c32e451a Mon Sep 17 00:00:00 2001 From: Tobias Herre Date: Fri, 13 Oct 2023 20:09:33 +0200 Subject: [PATCH] Default cfg and correct perms for /etc/mysql --- mysql.cf | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/mysql.cf b/mysql.cf index 52cd6b3..14cb1fe 100644 --- a/mysql.cf +++ b/mysql.cf @@ -2,31 +2,36 @@ # # -bundle agent mysql +bundle agent mysql(cfg_param) { vars: - "bind_address" string => "127.0.0.1"; - "user" string => "mysql"; - "port" string => "3306"; + "default_cfg" data => '{ + "bind_address":"127.0.0.1", + "user":"mysql", + "port":"3306" + }'; + + "cfg" data => mergedata(@(default_cfg),@(cfg_param)); freebsd:: # "pkg" string => "mariadb106-server"; "pkg" string => "mysql80-server"; "service_name" string => "mysql-server"; + "cfg_dir" string => "/usr/local/etc/mysql"; "cfg_file" string => "/usr/local/etc/mysql/my.cnf"; "mysql_cmd" string => "/usr/local/bin/mysql"; debian:: - "pkg" slist => {"mariadb-common", "mariadb-client", "mariadb-server"}; + "pkg" slist => {"mariadb-server"}; "service_name" string => "mysql"; + "cfg_dir" string => "/etc/mysql"; "cfg_file" string => "/etc/mysql/my.cnf"; "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: + "$(cfg_dir)/." + create => "true", + perms => mog("0755","root","root"), + handle => "mysql_cfg_dir_created"; + "$(cfg_file)" create => "true", @@ -34,7 +39,7 @@ files: edit_template => "$(sys.workdir)/inputs/$(def.wmde_libdir)/templates/my.cnf.mustache", template_method => "mustache", handle => "mysql_cfg_created", -# depends_on => {"mysql_db_installed"}, + depends_on => {"mysql_cfg_dir_created"}, classes => if_repaired("mysql_repaired"); @@ -53,6 +58,7 @@ services: service_policy => "restart", depends_on => {"mysql_running","mysql_cfg_created"}; +reports: }