Compare commits

...

6 Commits

Author SHA1 Message Date
Tube fb7878aa8f Merge branch 'main' of https://srcsrv.wikimedia.de/WMDE/wmdeit-cf-wmdelib 2023-11-01 16:00:52 +01:00
Tube eb537b7231 wget istall some pkgs which are missong on some ssyystems 2023-11-01 15:59:49 +01:00
Tube 9d503a50a2 Download by version is possible 2023-11-01 15:59:28 +01:00
Tube ee8b036231 Added mdules for FreeBSD 2023-11-01 15:59:02 +01:00
Tube 8eb884a046 download_file bundle added 2023-11-01 15:58:35 +01:00
Tube 504a72a48c Removed reports 2023-11-01 15:57:38 +01:00
5 changed files with 183 additions and 34 deletions

View File

@ -124,15 +124,6 @@ commands:
args => "certonly --agree-tos -n $(webroot_arg) --expand --email $(site[email]) $(args)";
reports:
# "CURRENT DOMAINS FOR $(site[domain]) : $(current_domains)";
# "EXEC IST: $(cert_test_cmd)";
# "IS '$(domains_txt)' == '$(current_domains_txt) ' ?";
# run_certbot_new::
# "WE MUST RUN CERTBOT FOR $(domains_txt)";
# !run_certbot_new::
# "WE SHOULD NOT RUN CERTBOT FOR $(domains_txt)";
}

71
lib.cf
View File

@ -288,3 +288,74 @@ methods:
reports:
}
bundle agent download_file(method,src,dst,cls,prms_arg)
{
vars:
"prms_default" data => '{
"m":"600",
"o":"$(sys.user_data[uid])",
"g":"$(sys.user_data[gid])"
}';
"prms" data => mergedata(@(prms_default),parsejson($(prms_arg)));
classes:
"$(method)";
wget::
"run_wget" expression => not(fileexists($(dst)));
files:
policyhub::
"$(dst)"
copy_from => remote_dcp("$(src)","$(sys.policy_hub)"),
classes => if_repaired("$(cls)_repaired"),
perms => mog ("$(prms[m])","$(prms[o])","$(prms[g])");
methods:
wget::
"any" usebundle => "install_wget", handle=>"wget_installed";
commands:
run_wget::
"$(wget.exe)"
args => "-q -O $(dst) $(src) || (rm -f $(dst) && /usr/bin/false) ",
contain => wmde_cmd_useshell,
handle => "$(cls)_downloaded",
classes => results("namespace","$(cls)"),
depends_on => {"wget_installed"},
inform => "true";
"/usr/bin/true"
depends_on => {"$(cls)_downloaded"},
classes => if_repaired("$(cls)_kept");
(!run_wget)&(wget)::
"/usr/bin/true"
classes => if_repaired("$(cls)_kept");
files:
"$(dst)"
perms => mog ("$(prms[m])","$(prms[o])","$(prms[g])"),
depends_on => {"$(cls)_downloaded"};
reports:
!run_wget::
"Not run wget";
run_wget::
"Run wget";
"$(cls)_repaired"::
"$(cls) repaired";
"!($(cls)_repaired)"::
"$(cls) not repaired";
"$(cls)_kept"::
"$(cls) kept";
"!($(cls)_kept)"::
"$(cls) not kept";
}

49
php.cf
View File

@ -21,14 +21,26 @@ vars:
"php$(php.bsdvs)-zip",
"php$(php.bsdvs)-pgsql",
"php$(php.bsdvs)-mysqli",
"php$(php.bsdvs)-pdo_mysql",
"php$(php.bsdvs)-pdo",
"php$(php.bsdvs)-filter",
"php$(php.bsdvs)-mbstring",
"php$(php.bsdvs)-dom",
"php$(php.bsdvs)-xml",
"php$(php.bsdvs)-ctype",
"php$(php.bsdvs)-intl",
"php$(php.bsdvs)-curl",
"php$(php.bsdvs)-fileinfo",
"php$(php.bsdvs)-exif",
"php$(php.bsdvs)-iconv",
"php$(php.bsdvs)-ldap",
"php$(php.bsdvs)-gd",
"php$(php.bsdvs)-pecl-imagick",
"php$(php.bsdvs)-pdo",
"php$(php.bsdvs)-pdo_sqlite",
"php$(php.bsdvs)-sqlite3",
"php$(php.bsdvs)-pdo_pgsql",
"php$(php.bsdvs)-pdo_mysql",
};
# "php$(bsdvs)-json",
@ -110,7 +122,10 @@ methods:
depends_on => {"php_repo_ready"};
commands:
freebsd::
"/usr/bin/true"
inform => "false",
handle => "php_repo_ready";
}
@ -171,6 +186,7 @@ vars:
"fpm_pkgs" slist => { "php$(version)-fpm" };
"fpm_service_name" string => "php$(version)-fpm";
"fpm_socket" string => "/run/php/php$(version)-fpm.sock";
"fpm_socket_type" string => "unix";
"apt_repo_url" string => "https://packages.sury.org/php/";
"apt_repo_key" string => "https://packages.sury.org/php/apt.gpg";
@ -190,14 +206,18 @@ vars:
freebsd::
"ini_files" slist => {
"/etc/php/$(install_php.version)/apache2/php.ini",
"/etc/php/$(install_php.version)/fpm/php.ini"
# "/etc/php/$(install_php.version)/apache2/php.ini",
# "/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";
"fpm_pkgs" slist => {};
"fpm_service_name" string => "php-fpm";
"fpm_socket" string => "127.0.0.1:9000";
"fpm_socket_type" string => "inet";
centos::
"cli_exe" string => "/usr/bin/php";
@ -219,22 +239,31 @@ files:
#methods:
# "any" usebundle => install_php;
reports:
"PHP VERSION: $(ini_files) V:$(install_php.version)";
# "PHP VERSION: $(ini_files) V:$(install_php.version)";
}
bundle agent install_php_fpm
{
vars:
"service_deps" slist => {
"php_fpm_pkgs_installed",
"php_pkgs_installed"
};
freebsd::
"service_deps" slist => {
"php_pkgs_installed"
};
methods:
"any" usebundle => install_php;
"any" usebundle => wmde_install_packages(@(php.fpm_pkgs),"php_fpm");
"any" usebundle => wmde_service("$(php.fpm_service_name)","php_kept|php_fpm_kept","php_repaired|php_fpm_repaired"),
depends_on =>{
"php_fpm_pkgs_installed",
"php_pkgs_installed"
};
depends_on => @(service_deps);
reports:
# "php ????";
}

View File

@ -5,12 +5,13 @@
bundle agent roundcube(cfg)
{
classes:
"dlbyversion" expression => not (isvariable ("cfg[src_tgz]"));
"roundcube_untar" expression => not(fileexists("$(cfg[install_sub_dir])/index.php"));
"config_exists" expression => fileexists("$(cfg[install_sub_dir])/config/config.inc.php");
"roundcube_untar" expression => not(fileexists("$(install_sub_dir)/index.php"));
"config_exists" expression => fileexists("$(install_sub_dir)/config/config.inc.php");
"backup_config_exists" expression => fileexists("$(cfg[backup_dir])/config.inc.php");
@ -22,21 +23,51 @@ classes:
"sql_backup_exists" expression => fileexists("$(cfg[backup_dir])/roundcube.sql");
vars:
"dlfile" string => "$(sys.workdir)/data/public/$(cfg[src_tgz])";
files:
"$(dlfile)"
copy_from => remote_dcp("$(def.hub_public_dir)/$(cfg[src_tgz])","$(sys.policy_hub)"),
handle => "roundcube_tgz_copied",
classes => if_repaired ("roundcube_untar"),
perms => m(644);
"dldir" string =>"$(sys.workdir)/data/agent/roundcube";
!(dlbyversion)::
"dlfile" string => "$(sys.workdir)/data/public/$(cfg[src_tgz])";
"dltype" string => "policyhub";
"dlsrc" string => "$(def.hub_public_dir)/$(cfg[src_tgz])";
"install_sub_dir" string => "$(cfg[install_sub_dir])";
dlbyversion::
"tgzname" string => "roundcubemail-$(cfg[version])-complete.tar.gz";
"dlfile" string => "$(dldir)/$(tgzname)";
"install_sub_dir" string => "$(cfg[install_dir])/roundcubemail-$(cfg[version])";
"dltype" string => "wget";
"dlsrc" string => "https://github.com/roundcube/roundcubemail/releases/download/$(cfg[version])/$(tgzname)";
reports:
dlbyversion::
"dl by version";
!dlbyversion::
"not dl by version";
files:
"$(dldir)/."
create => "true",
handle => "roundcube_agent_dir_created";
methods:
"any" usebundle => download_file("$(dltype)","$(dlsrc)","$(dlfile)","roundcube_tgz_file",'{}'),
handle => "roundcube_tgz_copied",
depends_on => {"roundcube_agent_dir_created"},
classes => if_repaired ("roundcube_untar");
# "$(dlfile)"
# copy_from => remote_dcp("$(def.hub_public_dir)/$(cfg[src_tgz])","$(sys.policy_hub)"),
# perms => m(644);
files:
"$(cfg[install_dir])/public"
link_from => ln_s("$(cfg[install_sub_dir])"),
link_from => ln_s("$(install_sub_dir)"),
move_obstructions => "true",
depends_on => {"roundcube_untarred"};
run_backups&(!config_exists)&backup_config_exists::
"$(cfg[install_sub_dir])/config/config.inc.php"
"$(install_sub_dir)/config/config.inc.php"
copy_from => local_cp("$(cfg[backup_dir])/config.inc.php"),
perms => m("644"),
classes => if_repaired("roundcube_config_repaired"),
@ -44,14 +75,14 @@ files:
run_backups&config_exists::
"$(cfg[backup_dir])/config.inc.php"
copy_from => local_dcp("$(cfg[install_sub_dir])/config/config.inc.php"),
copy_from => local_dcp("$(install_sub_dir)/config/config.inc.php"),
depends_on => {"roundcube_untarred"};
methods:
"any" usebundle => mysql_table_exists(@(cfg),"users");
config_exists|roundcube_configr_repaired::
"any" usebundle => rm_rf ("$(cfg[install_sub_dir])/installer");
"any" usebundle => rm_rf ("$(install_sub_dir)/installer");
commands:
roundcube_untar::
@ -94,3 +125,22 @@ reports:
# "ROUNDCUBE SHOULD RUN BACKUPS";
}
bundle agent download_roundcube(cfg)
{
vars:
"tgzname" string => "roundcubemail-$(cfg[version])-complete.tar.gz";
"dldir" string =>"$(sys.workdir)/data/agent/roundcube";
"dst" string => "$(dldir)/$(tgzname)";
files:
"$(dldir)/."
create => "true",
handle => "roundcube_agentdir_created";
methods:
"any" usebundle => download_file("wget",
"https://github.com/roundcube/roundcubemail/releases/download/$(cfg[version])/$(tgzname)",
"$(dst)","roundcube_tgz_file",'{}');
}

10
wget.cf
View File

@ -1,8 +1,16 @@
#
#
#
bundle agent wget
{
vars:
"pkgs" slist => {"wget","tar"};
freebsd::
"pkgs" slist => {"wget","curl"};
centos::
"pkgs" slist => {"wget","tar","bzip2","xz","unzip"};
"exe" string => "/usr/bin/wget";
freebsd::