wmdeit-cf-wmdelib/matomo.cf

54 lines
1.2 KiB
CFEngine3

#
#
#
bundle agent matomo
{
vars:
"src" string => "https://builds.matomo.org/matomo-4.15.1.zip";
"dst_dir" string => "$(sys.workdir)/data/agent/matomo";
"zip_file" string => "$(dst_dir)/matomo-4.15.1.zip";
"log_importer_install_dir" string => "/usr/local/bin";
"log_importer" string => "$(log_importer_install_dir)/import_logs.py";
}
bundle agent download_matomo
{
vars:
files:
"$(matomo.dst_dir)/."
create => "true",
handle => "matomo_download_dir_created";
methods:
"any" usebundle => download_file("wget","$(matomo.src)","$(matomo.zip_file)","matomo_zip_file",'{}'),
depends_on => {"matomo_download_dir_created"},
handle => "matomo_downloaded";
}
bundle agent install_matomo_log_importer
{
classes:
"importer_exists" expression => fileexists("$(matomo.log_importer)");
methods:
"any" usebundle => download_matomo;
commands:
!importer_exists::
"unzip"
args => "-o -j $(matomo.zip_file) matomo/misc/log-analytics/import_logs.py -d $(matomo.log_importer_install_dir)",
depends_on => {"matomo_downloaded"},
handle => "matomo_log_importer_installed",
contain => wmde_cmd_useshell;
importer_exists::
"/usr/bin/true"
inform => "false",
handle => "matomo_log_importer_installed";
}