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

View File

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