From 2f6eb07cc865c4fa185d089d7389eb064da5f8d4 Mon Sep 17 00:00:00 2001 From: Tobias Herre Date: Tue, 24 Oct 2023 17:12:45 +0200 Subject: [PATCH] Fxied some bugs regarding starting and restarting service --- apache.cf | 98 +++++++++++++++++++------------------------------------ 1 file changed, 33 insertions(+), 65 deletions(-) diff --git a/apache.cf b/apache.cf index 145ae34..cedd53a 100644 --- a/apache.cf +++ b/apache.cf @@ -140,30 +140,13 @@ vars: freebsd:: "pkgs" slist => {"mod_php$(php.bsdvs)"}; debian:: - "pkgs" slist => {"libapache2-mod-php"}; + "pkgs" slist => {"libapache2-mod-php$(php.version)"}; centos:: "pkgs" slist => {"libapache2-mod-php"}; -packages: - freebsd:: - "$(pkgs)" - policy => "present", - package_module => pkg, - handle => "apache_php_installed", - classes => if_repaired(apache_changed); - debian:: - "$(pkgs)" - policy => "present", - package_module => apt_get, - handle => "apache_php_installed", - depends_on => { "apache_mpm_event_disabled" }, - classes => if_repaired(apache_changed); - fedora|centos:: - "$(pkgs)" - policy => "present", - package_module => yum, - handle => "apache_php_installed", - classes => if_repaired(apache_changed); +methods: + "any" usebundle => wmde_install_packages(@(pkgs),"apache_php"), + handle => "apache_php_installed"; commands: debian|ubuntu:: @@ -171,46 +154,27 @@ commands: args => "-c '/usr/sbin/a2dismod mpm_event > /dev/null'", inform=>"false", handle => "apache_mpm_event_disabled"; - - } bundle agent install_apache(raw) { -classes: -packages: - freebsd:: - "$(apache.pkgs)" - policy => "present", - handle => "apache_pkgs_installed", - package_module => pkg, - classes => if_repaired(apache_changed); - debian:: - "$(apache.pkgs)" - policy => "present", - package_module => apt_get, - handle => "apache_pkgs_installed", - classes => if_repaired(apache_changed); - fedora|centos:: - "$(apache.pkgs)" - policy => "present", - package_module => yum, - handle => "apache_pkgs_installed", - classes => if_repaired(apache_changed); methods: + + "any" usebundle => wmde_install_packages(@(apache.pkgs),"apache"); + "any" usebundle => install_apache_php, depends_on => { "apache_pkgs_installed" }; -commands: -# freebsd:: -# "/usr/sbin/sysrc" -# handle => "apache_editrc", -# args => "apache24_enable=yes", -# inform=>"false"; -# debian|centos:: -# any:: -# "/bin/true" handle => "apache_editrc", -# inform => "false"; + +#services: +## apache_kept:: +# "$(apache.service_name)" +# service_policy => "start"; + + + +reports: + files: "$(apache.log_dir)/." @@ -241,21 +205,25 @@ files: create => "true", edit_template => "$(sys.workdir)/inputs/$(def.wmde_libdir)/templates/httpd.conf.mustache", template_method => "mustache", - handle => "apache_main_cfg_crreated", + handle => "apache_main_cfg_created", depends_on => { "apache_pkgs_installed","apache_php_installed" }, - classes => if_repaired(apache_changed); + classes => if_repaired(apache_repaired); -services: - # apache_editrs depends - "$(apache.service_name)" - depends_on => {"apache_vhost_dir_created","apache_www_dir_created","apache_main_cfg_crreated"}, - service_policy => "start", - handle => "apache_running"; +methods: + + "any" usebundle => wmde_service("$(apache.service_name)","apache_kept","apache_repaired|php_repaired"), + depends_on => { + "apache_pkgs_installed", + "apache_php_pkgs_installed", + "apache_www_dir_created", + "apache_vhost_dir_created", + "apache_main_cfg_created" + }; + + #depends_on => { + # "apache_php_pkgs_installed" - "php_changed|apache_changed":: - "$(apache.service_name)" - depends_on => {"apache_vhost_dir_created","apache_www_dir_created","apache_main_cfg_crreated"}, - service_policy => "restart"; + #}; }