Fixes for FreeBSD

This commit is contained in:
Tube 2023-10-22 00:09:18 +02:00
parent 6fe82e7b32
commit a79fb41c3a
4 changed files with 57 additions and 27 deletions

View File

@ -10,12 +10,16 @@
bundle agent apache
{
vars:
"admin_email" string => "[]",unless => isvariable( $(this.promiser) ) ;
freebsd::
"pkgs" slist => {
"apache24",
};
"log_dir" string =>"/var/log/httpd";
"log_dir_owner" string => "root";
"log_dir_group" string => "wheel";
"service_name" string => "apache24";
"www_user" string => "www";
"www_group" string => "www";
@ -34,7 +38,7 @@ vars:
{m: "log_config",f:"mod_log_config"},
{m: "version",f:"mod_version"},
{m: "unixd",f:"mod_unixd"},
{m: "php7",f:"libphp7"},
{m: "$(php.apache_m)",f:"$(php.apache_f)"},
{m: "ssl",f:"mod_ssl"}
]';
@ -45,6 +49,8 @@ vars:
"libapache2-mod-svn",
};
"log_dir" string =>"/var/log/apache2";
"log_dir_owner" string => "root";
"log_dir_group" string => "adm";
"service_name" string => "apache2";
"restart_cmd" string => "/usr/bin/systemctl restart $(service_name)";
"www_user" string => "www-data";
@ -79,6 +85,9 @@ vars:
};
fedora|centos::
"log_dir" string =>"/var/log/httpd";
"log_dir_owner" string => "root";
"log_dir_group" string => "wheel";
"service_name" string => "httpd";
"restart_cmd" string => "/usr/bin/systemctl restart $(service_name)";
"www_user" string => "apache";
@ -109,6 +118,9 @@ vars:
"phpm" string => "php";
ubuntu::
"log_dir_owner" string => "root";
"log_dir_group" string => "adm";
"modules" data => '[
{m:"$(phpm)",f:"libphp$(install_php.version)"},
{m:"proxy",f:"mod_proxy"},
@ -125,8 +137,8 @@ vars:
bundle agent install_apache_php
{
vars:
freeebsd::
"pkgs" slist => {"mod_php74"};
freebsd::
"pkgs" slist => {"mod_php$(php.bsdvs)"};
debian::
"pkgs" slist => {"libapache2-mod-php"};
centos::
@ -154,10 +166,12 @@ packages:
classes => if_repaired(apache_changed);
commands:
"/bin/sh"
args => "-c '/usr/sbin/a2dismod mpm_event > /dev/null'",
inform=>"false",
handle => "apache_mpm_event_disabled";
debian|ubuntu::
"/bin/sh"
args => "-c '/usr/sbin/a2dismod mpm_event > /dev/null'",
inform=>"false",
handle => "apache_mpm_event_disabled";
}
@ -169,8 +183,8 @@ packages:
freebsd::
"$(apache.pkgs)"
policy => "present",
package_module => pkg,
handle => "apache_pkgs_installed",
package_module => pkg,
classes => if_repaired(apache_changed);
debian::
"$(apache.pkgs)"
@ -198,9 +212,14 @@ commands:
inform => "false";
files:
"$(apache.log_dir)/."
create=>"true",
perms=>mog("750","$(apache.log_dir_owner)","$(apache.log_dir_group)"),
handle => "apache_log_dir_created";
"$(apache.www_dir)/."
create=>"true",
perms => uperm("root","root","755"),
perms => m("755"),
depends_on => { "apache_pkgs_installed" },
handle => "apache_www_dir_created";
@ -213,7 +232,7 @@ files:
"$(apache.cfg_dir)/Vhosts/dummy.conf"
create=>"true",
content=>"",
perms => uperm("root","root","644"),
perms => m("644"),
depends_on => { "apache_pkgs_installed" },
handle=> "apache_vhost_dir_created";
@ -235,13 +254,19 @@ services:
"$(apache.service_name)"
depends_on => {"apache_vhost_dir_created","apache_www_dir_created","apache_main_cfg_crreated"},
service_policy => "restart";
}
bundle agent restart_apache(arg)
{
commands:
"/bin/sh -c "
args => "'/bin/echo $(arg) > /dev/null && /usr/bin/systemctl restart $(apache.service_name)'";
methods:
"any" usebundle => wmde_restart_service("$(apache.service_name)","$(arg)");
#commands:
# "/bin/sh -c "
# args => "'/bin/echo $(arg) > /dev/null && /usr/bin/systemctl restart $(apache.service_name)'";
}
@ -258,7 +283,7 @@ vars:
{
"aliases":[],
"ssl_cert":"certbot",
"email":"$(apache.admin_email)",
"email":$(apache.admin_email),
"doc_root":"$(apache.www_dir)/$(site_param[domain])"
}
';

2
lib.cf
View File

@ -122,7 +122,7 @@ commands:
args => "'/bin/echo $(id) > /dev/null && /usr/bin/systemctl restart $(service_name)'";
freebsd::
"/bin/sh -c "
args => "'/bin/echo $(id) > /dev/null && /usr/sbin/service onerestart $(service_name)'";
args => "'/bin/echo $(id) > /dev/null && /usr/sbin/service $(service_name) onerestart'";
}

25
php.cf
View File

@ -12,21 +12,24 @@ vars:
ubuntu_22::
"version" string => "8.1";
freebsd::
"version" string => "7.4";
"version" string => "$(php.version)";
"bsdvs" string => "$(php.bsdvs)";
freebsd::
"cli_exe" string => "/usr/local/bin/php";
"pkgs" slist => {
"php74-session",
"php74-zip",
"php74-pgsql",
"php74-mysqli",
"php74-pdo_mysql",
"php74-pdo",
"php74-filter",
"php74-json",
"php$(bsdvs)-session",
"php$(bsdvs)-zip",
"php$(bsdvs)-pgsql",
"php$(bsdvs)-mysqli",
"php$(bsdvs)-pdo_mysql",
"php$(bsdvs)-pdo",
"php$(bsdvs)-filter",
};
# "php$(bsdvs)-json",
debian::
@ -91,6 +94,10 @@ vars:
"/etc/php/$(install_php.version)/fpm/php.ini"
};
"cli_exe" string => "/usr/local/bin/php";
"version" string => "8.2";
"bsdvs" string => "82";
"apache_m" string => "php";
"apache_f" string => "libphp";
files:

View File

@ -571,9 +571,7 @@ SSLRandomSeed connect builtin
DirectoryIndex index.html
</Directory>
<VirtualHost *:80>
{{#vars.apache.admin_email}}
ServerAdmin {{.}}
{{/vars.apache.admin_email}}
#ServerAdmin
DocumentRoot "{{vars.apache.default_html_dir}}"
ErrorLog "{{vars.apache.log_dir}}/default-error.log"
CustomLog "{{vars.apache.log_dir}}/default-access.log" common