Compare commits

..

No commits in common. "94abf0568a423dd87d7318a368ca7d81e2ace267" and "b962c1452a0619d13048c3c753ef22f736bf2c7a" have entirely different histories.

7 changed files with 17 additions and 73 deletions

View File

@ -50,7 +50,6 @@ vars:
freebsd:: freebsd::
"pkgs" slist => { "pkgs" slist => {
"apache24", "apache24",
"mod_dav_svn",
}; };
"log_dir" string =>"/var/log/httpd"; "log_dir" string =>"/var/log/httpd";
"log_dir_owner" string => "root"; "log_dir_owner" string => "root";
@ -81,10 +80,7 @@ vars:
{m:"proxy_fcgi",f:"mod_proxy_fcgi"}, {m:"proxy_fcgi",f:"mod_proxy_fcgi"},
{m:"proxy_http",f:"mod_proxy_http"}, {m:"proxy_http",f:"mod_proxy_http"},
{m:"proxy_http2",f:"mod_proxy_http2"}, {m:"proxy_http2",f:"mod_proxy_http2"},
{m:"remoteip",f:"mod_remoteip"}, {m:"remoteip",f:"mod_remoteip"}
{m: "dav",f:"mod_dav"},
{m: "dav_svn", f:"mod_dav_svn"},
{m: "authz_svn", f:"mod_authz_svn"}
]'; ]';
@ -454,17 +450,15 @@ vars:
"pid" string => "/var/run/matomo-logger-$(site[domain]).pid"; "pid" string => "/var/run/matomo-logger-$(site[domain]).pid";
"log" string => "$(apache.log_dir)/$(site[domain])-access.log"; "log" string => "$(apache.log_dir)/$(site[domain])-access.log";
"siteid" string => "$(site[matomoid])"; "siteid" string => "$(site[matomoid])";
"logger_script" string => "/tmp/matomo-logger-$(site[domain]).sh";
freebsd:: freebsd::
"analyt_cmd" string => "/usr/local/bin/python3.9 $(matomo.log_importer)"; "analyt_cmd" string => "/usr/local/bin/python3.9 /var/www/matomo/misc/log-analytics/import_logs.py";
debian:: debian::
"analyt_cmd" string => "/usr/bin/python3 $(matomo.log_importer)"; "analyt_cmd" string => "/usr/bin/python3 /var/www/matomo/misc/log-analytics/import_logs.py";
centos:: centos::
"analyt_cmd" string => "/usr/bin/python3 $(matomo.log_importer)"; "analyt_cmd" string => "/usr/bin/python3 /var/www/matomo/misc/log-analytics/import_logs.py";
matomo:: matomo::
"cmd" string => "/usr/bin/pkill -P `cat $(pid)` ; exec /bin/sh -c 'echo $$ > $(pid); echo \"hello\" | /usr/bin/tail -n+1 -f $(log) | $(analyt_cmd) --token-auth=$(site[matomotoken]) --disable-bulk-tracking --idsite=$(siteid) --url=$(site[matomosite]) --exclude-path=/wp-login.php --exclude-path=/wp-json/\\* --recorders=1 --recorder-max-payload-size=1 --log-format-name=ncsa_extended --exclude-path=\\*.php --exclude-path=/wp-admin/\\* - > /dev/null' "cmd" string => "/usr/bin/pkill -P `cat $(pid)` ; exec /bin/sh -c 'echo $$ > $(pid); /usr/bin/tail -n+1 -f $(log) | $(analyt_cmd) --token-auth=$(site[matomotoken]) --disable-bulk-tracking --idsite=$(siteid) --url=$(site[matomosite]) --exclude-path=/wp-login.php --exclude-path=/wp-json/* --recorders=1 --recorder-max-payload-size=1 --log-format-name=ncsa_extended --exclude-path=*.php --exclude-path=/wp-admin/* - > /dev/null' ";
";
!matomo:: !matomo::
"cmd" string => ""; "cmd" string => "";
any:: any::
@ -500,21 +494,7 @@ files:
"$(pid)" "$(pid)"
create => "true"; create => "true";
"$(logger_script)"
create => "true",
perms => m("755"),
content => '#!/bin/sh
if [ "$1" != "child" ]; then
"$(logger_script)" child &
else
setsid >/dev/null 2>&1
exec 0<&- 1>/dev/null 2>&1
$(cmd)
fi
',
handle => "loggerscript_$(site[domain])_created";
classes: classes:
"matomo" expression => isvariable("site[matomoid]"); "matomo" expression => isvariable("site[matomoid]");
@ -527,22 +507,10 @@ commands:
inform => "false", inform => "false",
module => "true"; module => "true";
start_matomo::
"$(logger_script)"
args => "$(logger_script)",
contain => wmde_cmd_useshell,
depends_on => {"loggerscript_$(site[domain])_created"};
# "/bin/sh"
# args => "$(logger_script) &",
# contain => wmde_cmd_useshell,
# depends_on => {"loggerscript_$(site[domain])_created"};
methods: methods:
# start_matomo:: start_matomo::
# "call" usebundle => daemonize( "/bin/sh $(logger_script)" ), "call" usebundle => daemonize( "$(cmd)" );
# depends_on => {"loggerscript_$(site[domain])_created"};
reports: reports:
#start_matomo:: #start_matomo::

View File

@ -44,7 +44,7 @@ files:
freebsd:: freebsd::
"/etc/cron.d/certbot" "/etc/cron.d/certbot"
create => "true", create => "true",
copy_from => local_dcp("$(sys.workdir)/inputs/$(def.wmde_libdir)/templates/certbot-cron.mustache"); copy_from => local_cp("$(sys.workdir)/inputs/$(def.wmde_libdir)/templates/certbot-cron.mustache");
# content => '# # content => '#
# Managed by CFEngine # Managed by CFEngine

17
lib.cf
View File

@ -336,7 +336,7 @@ files:
perms => mog ("$(prms[m])","$(prms[o])","$(prms[g])"); perms => mog ("$(prms[m])","$(prms[o])","$(prms[g])");
methods: methods:
wget:: wget::
"any" usebundle => "install_wget"; #, handle=>"wget_installed"; "any" usebundle => "install_wget", handle=>"wget_installed";
commands: commands:
run_wget:: run_wget::
@ -393,18 +393,3 @@ commands:
args => "-a"; args => "-a";
} }
bundle agent etc_hosts(hosts)
{
vars:
"idx" slist => getindices(@(hosts));
"settings[$(idx)]" string => "$(hosts[$(idx)])";
files:
"/etc/hosts"
create => "true",
perms => m("644"),
edit_line => set_config_values("$(this.bundle).settings"),
classes => results("namespace","etc_hosts");
}

View File

@ -20,12 +20,11 @@ vars:
"user" string => "mysql"; "user" string => "mysql";
"server_pkgs" slist => {"mysql80-server"}; "server_pkgs" slist => {"mysql80-server"};
"client_pkgs" slist => {"mysql80-client"}; "client_pkgs" slist => {"mysql80-client"};
"type" string => "mysql8";
"server_pkgs" slist => {"mariadb106-server"}, if => strcmp("$(cfg[mariadb])","true"); "server_pkgs" slist => {"mariadb106-server"}, if => strcmp("$(cfg[mariadb])","true");
"client_pkgs" slist => {"mariadb106-client"}, if => strcmp("$(cfg[mariadb])","true"); "client_pkgs" slist => {"mariadb106-client"}, if => strcmp("$(cfg[mariadb])","true");
"type" string => "mariadb",if => strcmp("$(cfg[mariadb])","true");
"type" string => "mysql8";
"service_name" string => "mysql-server"; "service_name" string => "mysql-server";
"cfg_dir" string => "/usr/local/etc/mysql"; "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";
@ -435,12 +434,9 @@ classes:
vars: vars:
"table_exists" string => "mysql_$(cfg[db_name])_$(cfg[db_check_table])_exists"; "table_exists" string => "mysql_$(cfg[db_name])_$(cfg[db_check_table])_exists";
methods: methods:
"any" usebundle => mysql_table_exists(@(cfg),"$(cfg[db_check_table])"), "any" usebundle => mysql_table_exists(@(cfg),"$(cfg[db_check_table])");
handle=>"$(table_exists)_checked";
"!$(table_exists)&backup_exists":: "!$(table_exists)&backup_exists"::
"any" usebundle => restore_mysql_db(@(cfg),"$(file)"), "any" usebundle => restore_mysql_db(@(cfg),"$(file)");
depends_on=>{"$(table_exists)_checked"};
reports: reports:
} }

8
php.cf
View File

@ -192,7 +192,7 @@ vars:
"fpm_pkgs" slist => { "php$(version)-fpm" }; "fpm_pkgs" slist => { "php$(version)-fpm" };
"fpm_service_name" string => "php$(version)-fpm"; "fpm_service_name" string => "php$(version)-fpm";
"fpm_socket" string => "/run/php/php$(version)-fpm.sock"; "fpm_socket" string => "/run/php/php$(version)-fpm.sock";
"fpm_socket_type" string => "unix:"; "fpm_socket_type" string => "unix";
"apt_repo_url" string => "https://packages.sury.org/php/"; "apt_repo_url" string => "https://packages.sury.org/php/";
"apt_repo_key" string => "https://packages.sury.org/php/apt.gpg"; "apt_repo_key" string => "https://packages.sury.org/php/apt.gpg";
@ -223,7 +223,7 @@ vars:
"fpm_pkgs" slist => {}; "fpm_pkgs" slist => {};
"fpm_service_name" string => "php-fpm"; "fpm_service_name" string => "php-fpm";
"fpm_socket" string => "127.0.0.1:9000"; "fpm_socket" string => "127.0.0.1:9000";
"fpm_socket_type" string => "fcgi://"; "fpm_socket_type" string => "inet";
centos:: centos::
"cli_exe" string => "/usr/bin/php"; "cli_exe" string => "/usr/bin/php";
@ -231,7 +231,6 @@ vars:
"fpm_pkgs" slist => { "php-fpm" }; "fpm_pkgs" slist => { "php-fpm" };
"fpm_service_name" string => "php$(version)-fpm"; "fpm_service_name" string => "php$(version)-fpm";
"fpm_socket" string => "/run/php-fpm/www.sock"; "fpm_socket" string => "/run/php-fpm/www.sock";
"fpm_socket_type" string => "unix:";
files: files:
@ -261,14 +260,11 @@ vars:
"service_deps" slist => { "service_deps" slist => {
"php_pkgs_installed" "php_pkgs_installed"
}; };
"service_name" string => "$(php.fpm_service_name)";
"service_cfg_name" string => "php_fpm";
methods: methods:
"any" usebundle => install_php; "any" usebundle => install_php;
"any" usebundle => wmde_install_packages(@(php.fpm_pkgs),"php_fpm"); "any" usebundle => wmde_install_packages(@(php.fpm_pkgs),"php_fpm");
"any" usebundle => wmde_enable_service("$(this.bundle)");
"any" usebundle => wmde_service("$(php.fpm_service_name)","php_kept|php_fpm_kept","php_repaired|php_fpm_repaired"), "any" usebundle => wmde_service("$(php.fpm_service_name)","php_kept|php_fpm_kept","php_repaired|php_fpm_repaired"),
depends_on => @(service_deps); depends_on => @(service_deps);

View File

@ -11,7 +11,7 @@ vars:
freebsd:: freebsd::
"pkgs" slist => { "pkgs" slist => {
"postfix", "postfix-mysql",
#"postfix", #"postfix",
}; };
"db_dir" string => "/var/db"; "db_dir" string => "/var/db";

View File

@ -22,7 +22,6 @@ vars:
bundle agent install_wget bundle agent install_wget
{ {
methods: methods:
"any" usebundle => wmde_install_packages(@(wget.pkgs),"wget"), "any" usebundle => wmde_install_packages(@(wget.pkgs),"wget");
handle=>"wget_installed";
} }