Compare commits
No commits in common. "a362bc106a705a0377924017d90b6ff87f8a36bc" and "71bef3b692cd4f22190abfe5738e5987484cb431" have entirely different histories.
a362bc106a
...
71bef3b692
167
apache.cf
167
apache.cf
|
@ -9,39 +9,9 @@
|
|||
|
||||
bundle agent apache
|
||||
{
|
||||
classes:
|
||||
# "apache enable_php";
|
||||
|
||||
vars:
|
||||
"admin_email" string => "[]",unless => isvariable( $(this.promiser) ) ;
|
||||
|
||||
|
||||
|
||||
|
||||
apache_php_enable::
|
||||
"php_mod" string => '{m: "$(php.apache_m)",f:"$(php.apache_f)"},';
|
||||
"service_deps" slist => {
|
||||
"apache_pkgs_installed",
|
||||
"apache_php_pkgs_installed",
|
||||
"apache_www_dir_created",
|
||||
"apache_vhost_dir_created",
|
||||
"apache_main_cfg_created"
|
||||
};
|
||||
|
||||
"cfg_deps" slist => { "apache_pkgs_installed","apache_php_installed" };
|
||||
|
||||
!apache_php_enable::
|
||||
"php_mod" string => "";
|
||||
"service_deps" slist => {
|
||||
"apache_pkgs_installed",
|
||||
"apache_www_dir_created",
|
||||
"apache_vhost_dir_created",
|
||||
"apache_main_cfg_created"
|
||||
};
|
||||
|
||||
"cfg_deps" slist => { "apache_pkgs_installed" };
|
||||
|
||||
|
||||
freebsd::
|
||||
"pkgs" slist => {
|
||||
"apache24",
|
||||
|
@ -64,11 +34,11 @@ vars:
|
|||
"default_html_dir" string => "$(www_dir)/apache24";
|
||||
"server_root" string => "/usr/local";
|
||||
"modules" data => '[
|
||||
$(php_mod)
|
||||
{m: "autoindex",f:"mod_autoindex"},
|
||||
{m: "log_config",f:"mod_log_config"},
|
||||
{m: "version",f:"mod_version"},
|
||||
{m: "unixd",f:"mod_unixd"},
|
||||
{m: "$(php.apache_m)",f:"$(php.apache_f)"},
|
||||
{m: "ssl",f:"mod_ssl"}
|
||||
]';
|
||||
|
||||
|
@ -95,13 +65,11 @@ vars:
|
|||
"server_root" string => "/usr";
|
||||
|
||||
"modules" data => '[
|
||||
$(php_mod)
|
||||
{m:"php",f:"libphp8.2"},
|
||||
{m:"ssl",f:"mod_ssl"},
|
||||
{m:"proxy",f:"mod_proxy"},
|
||||
{m:"proxy_fcgi",f:"mod_proxy_fcgi"}
|
||||
]';
|
||||
# {m:"php",f:"libphp$(php.version)"},
|
||||
|
||||
|
||||
|
||||
centos::
|
||||
|
@ -163,9 +131,6 @@ vars:
|
|||
{m: "authz_svn", f:"mod_authz_svn"},
|
||||
{m: "ssl",f:"mod_ssl"}
|
||||
]';
|
||||
|
||||
reports:
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -175,13 +140,30 @@ vars:
|
|||
freebsd::
|
||||
"pkgs" slist => {"mod_php$(php.bsdvs)"};
|
||||
debian::
|
||||
"pkgs" slist => {"libapache2-mod-php$(php.version)"};
|
||||
"pkgs" slist => {"libapache2-mod-php"};
|
||||
centos::
|
||||
"pkgs" slist => {"libapache2-mod-php"};
|
||||
|
||||
methods:
|
||||
"any" usebundle => wmde_install_packages(@(pkgs),"apache_php"),
|
||||
handle => "apache_php_installed";
|
||||
packages:
|
||||
freebsd::
|
||||
"$(pkgs)"
|
||||
policy => "present",
|
||||
package_module => pkg,
|
||||
handle => "apache_php_installed",
|
||||
classes => if_repaired(apache_changed);
|
||||
debian::
|
||||
"$(pkgs)"
|
||||
policy => "present",
|
||||
package_module => apt_get,
|
||||
handle => "apache_php_installed",
|
||||
depends_on => { "apache_mpm_event_disabled" },
|
||||
classes => if_repaired(apache_changed);
|
||||
fedora|centos::
|
||||
"$(pkgs)"
|
||||
policy => "present",
|
||||
package_module => yum,
|
||||
handle => "apache_php_installed",
|
||||
classes => if_repaired(apache_changed);
|
||||
|
||||
commands:
|
||||
debian|ubuntu::
|
||||
|
@ -190,22 +172,45 @@ commands:
|
|||
inform=>"false",
|
||||
handle => "apache_mpm_event_disabled";
|
||||
|
||||
reports:
|
||||
|
||||
}
|
||||
|
||||
bundle agent install_apache(raw)
|
||||
{
|
||||
classes:
|
||||
|
||||
packages:
|
||||
freebsd::
|
||||
"$(apache.pkgs)"
|
||||
policy => "present",
|
||||
handle => "apache_pkgs_installed",
|
||||
package_module => pkg,
|
||||
classes => if_repaired(apache_changed);
|
||||
debian::
|
||||
"$(apache.pkgs)"
|
||||
policy => "present",
|
||||
package_module => apt_get,
|
||||
handle => "apache_pkgs_installed",
|
||||
classes => if_repaired(apache_changed);
|
||||
fedora|centos::
|
||||
"$(apache.pkgs)"
|
||||
policy => "present",
|
||||
package_module => yum,
|
||||
handle => "apache_pkgs_installed",
|
||||
classes => if_repaired(apache_changed);
|
||||
methods:
|
||||
|
||||
"any" usebundle => wmde_install_packages(@(apache.pkgs),"apache");
|
||||
|
||||
apache_php_enable::
|
||||
"any" usebundle => install_apache_php,
|
||||
depends_on => { "apache_pkgs_installed" };
|
||||
|
||||
reports:
|
||||
|
||||
commands:
|
||||
# freebsd::
|
||||
# "/usr/sbin/sysrc"
|
||||
# handle => "apache_editrc",
|
||||
# args => "apache24_enable=yes",
|
||||
# inform=>"false";
|
||||
# debian|centos::
|
||||
# any::
|
||||
# "/bin/true" handle => "apache_editrc",
|
||||
# inform => "false";
|
||||
|
||||
files:
|
||||
"$(apache.log_dir)/."
|
||||
|
@ -236,41 +241,21 @@ files:
|
|||
create => "true",
|
||||
edit_template => "$(sys.workdir)/inputs/$(def.wmde_libdir)/templates/httpd.conf.mustache",
|
||||
template_method => "mustache",
|
||||
handle => "apache_main_cfg_created",
|
||||
depends_on => { @(apache.cfg_deps) },
|
||||
classes => if_repaired(apache_repaired);
|
||||
handle => "apache_main_cfg_crreated",
|
||||
depends_on => { "apache_pkgs_installed","apache_php_installed" },
|
||||
classes => if_repaired(apache_changed);
|
||||
|
||||
methods:
|
||||
services:
|
||||
# apache_editrs depends
|
||||
"$(apache.service_name)"
|
||||
depends_on => {"apache_vhost_dir_created","apache_www_dir_created","apache_main_cfg_crreated"},
|
||||
service_policy => "start",
|
||||
handle => "apache_running";
|
||||
|
||||
|
||||
"any" usebundle => wmde_service("$(apache.service_name)","apache_kept","apache_repaired|php_repaired"),
|
||||
depends_on => @(apache.service_deps) ;
|
||||
|
||||
#depends_on => {
|
||||
# "apache_php_pkgs_installed"
|
||||
|
||||
#};
|
||||
#
|
||||
|
||||
files:
|
||||
"$(sys.workdir)/data/agent/apache/."
|
||||
create => "true",
|
||||
handle => "apache_work_dir_created";
|
||||
commands:
|
||||
"/bin/sh"
|
||||
args => "$(sys.workdir)/inputs/$(def.wmde_libdir)/scripts/del-files-not-in-list.sh $(apache.cfg_dir)/Vhosts $(sys.workdir)/data/agent/apache/domains.txt && echo dummy.conf > $(sys.workdir)/data/agent/apache/domains.txt",
|
||||
inform => "false",
|
||||
contain => wmde_cmd_useshell;
|
||||
|
||||
|
||||
|
||||
# "echo"
|
||||
# args => "dummy.conf > $(sys.workdir)/data/agent/apache/domains.txt",
|
||||
# inform => "false",
|
||||
# contain => wmde_cmd_useshell;
|
||||
|
||||
|
||||
reports:
|
||||
"php_changed|apache_changed"::
|
||||
"$(apache.service_name)"
|
||||
depends_on => {"apache_vhost_dir_created","apache_www_dir_created","apache_main_cfg_crreated"},
|
||||
service_policy => "restart";
|
||||
|
||||
|
||||
}
|
||||
|
@ -365,18 +350,17 @@ methods:
|
|||
"any" usebundle => restart_apache("$(site[domain])"),
|
||||
depends_on => {"vhost_cfg_done$(site[domain])" };
|
||||
|
||||
commands:
|
||||
|
||||
|
||||
"echo"
|
||||
args => "$(site[domain]).conf >> $(sys.workdir)/data/agent/apache/domains.txt",
|
||||
inform => "false",
|
||||
depends_on => {"vhost_cfg_done$(site[domain])"},
|
||||
contain => wmde_cmd_useshell;
|
||||
|
||||
|
||||
|
||||
reports:
|
||||
# "SSL_CERT: $(ssl_cert) $(ssl_key) ";
|
||||
# use_ssl::
|
||||
# "USE SSL";
|
||||
# !use_ssl::
|
||||
# "NOT USE_SSL";
|
||||
|
||||
# "RAW: $(site[raw])";
|
||||
# "APACHE DOCROOT $(site[doc_root])";
|
||||
}
|
||||
|
||||
|
||||
|
@ -388,5 +372,6 @@ methods:
|
|||
"any" usebundle => apache_vhost(@(sites[$(idx)]));
|
||||
|
||||
reports:
|
||||
# "IDXE $(idx)";
|
||||
|
||||
}
|
||||
|
|
29
lib.cf
29
lib.cf
|
@ -172,32 +172,3 @@ reports:
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
bundle agent install_apt_repo(name,repo_src,key_src,key_name)
|
||||
{
|
||||
classes:
|
||||
debian|ubuntu::
|
||||
"do_install" expression => not(fileexists("/etc/apt/sources.list.d/$(name).list"));
|
||||
|
||||
|
||||
vars:
|
||||
do_install::
|
||||
"pkgs" slist => {
|
||||
"curl",
|
||||
"ca-certificates",
|
||||
"lsb-release"
|
||||
};
|
||||
|
||||
"add_repo_cmd" string => "/usr/bin/add-apt-repository";
|
||||
|
||||
methods:
|
||||
do_install::
|
||||
"any" usebundle => wmde_install_packages(@(pkgs),"apt_repo");
|
||||
|
||||
commands:
|
||||
do_install::
|
||||
"/bin/sh"
|
||||
args => "$(sys.workdir)/inputs/$(def.wmde_libdir)/scripts/install-php-repo.sh $(name) $(repo_src) $(key_src) $(key_name)";
|
||||
|
||||
}
|
||||
|
|
104
php.cf
104
php.cf
|
@ -4,12 +4,19 @@
|
|||
|
||||
bundle agent install_php
|
||||
{
|
||||
classes:
|
||||
"php_install_repo" expression => not(fileexists("/etc/apt/sources.list.d/php.list"));
|
||||
vars:
|
||||
"version" string => "$(php.version)";
|
||||
|
||||
debian::
|
||||
"version" string => "8.2";
|
||||
ubuntu_20::
|
||||
"version" string => "7.4";
|
||||
ubuntu_22::
|
||||
"version" string => "8.1";
|
||||
freebsd::
|
||||
"version" string => "$(php.version)";
|
||||
"bsdvs" string => "$(php.bsdvs)";
|
||||
|
||||
|
||||
|
||||
|
||||
freebsd::
|
||||
"cli_exe" string => "/usr/local/bin/php";
|
||||
|
@ -32,19 +39,19 @@ vars:
|
|||
|
||||
debian::
|
||||
"pkgs" slist => {
|
||||
"php$(version)-cli",
|
||||
"php-cli",
|
||||
"php$(version)-common",
|
||||
"php$(version)-zip",
|
||||
"php$(version)-pgsql",
|
||||
"php$(version)-mysql",
|
||||
"php-json",
|
||||
"php$(version)-xml",
|
||||
"php$(version)-gd",
|
||||
"php$(version)-mbstring",
|
||||
"php$(version)-intl",
|
||||
"php$(version)-curl",
|
||||
"php$(version)-imagick",
|
||||
"php$(version)-ldap",
|
||||
"php-json"
|
||||
"php-gd",
|
||||
"php-mbstring",
|
||||
"php-intl",
|
||||
"php-curl",
|
||||
"php-imagick",
|
||||
"php-ldap",
|
||||
|
||||
};
|
||||
ubuntu::
|
||||
|
@ -61,60 +68,31 @@ vars:
|
|||
};
|
||||
|
||||
|
||||
commands:
|
||||
# (debian|ubuntu)&php_install_repo::
|
||||
# "/bin/sh"
|
||||
# args => "$(sys.workdir)/inputs/$(def.wmde_libdir)/scripts/install-php-sury.sh",
|
||||
# handle => "php_repo_ready";
|
||||
# (debian|ubuntu)&(!php_install_repo)::
|
||||
# "/usr/bin/true"
|
||||
# inform => "false",
|
||||
# handle => "php_repo_ready";
|
||||
|
||||
# !(debian|ubuntu)::
|
||||
|
||||
|
||||
methods:
|
||||
"any" usebundle => install_apt_repo("php","$(php.apt_repo_url)","$(php.apt_repo_key)","$(php.apt_repo_key_name)"),
|
||||
handle => "php_repo_ready";
|
||||
|
||||
"any" usebundle => wmde_install_packages(@(pkgs),"php"),
|
||||
depends_on => {"php_repo_ready"};
|
||||
packages:
|
||||
freebsd::
|
||||
"$(pkgs)"
|
||||
policy => "present",
|
||||
package_module => pkg,
|
||||
classes => if_repaired(php_changed);
|
||||
debian::
|
||||
"$(pkgs)"
|
||||
policy => "present",
|
||||
package_module => apt_get,
|
||||
handle => "php_installed",
|
||||
classes => if_repaired(php_changed);
|
||||
}
|
||||
|
||||
bundle agent php(settings)
|
||||
{
|
||||
vars:
|
||||
|
||||
debian::
|
||||
"version" string => "8.0";
|
||||
"ini_files" slist => {
|
||||
"/etc/php/$(php.version)/apache2/php.ini",
|
||||
"/etc/php/$(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/bin/php";
|
||||
|
||||
"fpm_pkgs" slist => { "php$(version)-fpm" };
|
||||
"fpm_service_name" string => "php$(version)-fpm";
|
||||
"fpm_socket" string => "/run/php/php$(version)-fpm.sock";
|
||||
|
||||
"apt_repo_url" string => "https://packages.sury.org/php/";
|
||||
"apt_repo_key" string => "https://packages.sury.org/php/apt.gpg";
|
||||
"apt_repo_key_name" string=> "deb.sury.org-php.gpg";
|
||||
|
||||
"apache_m" string => "php";
|
||||
"apache_f" string => "libphp$(php.version)";
|
||||
|
||||
ubuntu::
|
||||
"apt_repo_url" string => "https://ppa.launchpadcontent.net/ondrej/php/ubuntu/";
|
||||
"apt_repo_key" string => "";
|
||||
"apt_repo_key_name" string=> "";
|
||||
|
||||
ubuntu_22::
|
||||
"version" string => "8.2";
|
||||
|
||||
|
||||
freebsd::
|
||||
"ini_files" slist => {
|
||||
"/etc/php/$(install_php.version)/apache2/php.ini",
|
||||
|
@ -133,7 +111,7 @@ files:
|
|||
edit_template => "$(sys.workdir)/inputs/$(wmde_libdir)/templates/php.ini.mustache",
|
||||
template_method => "mustache",
|
||||
template_data => @(settings),
|
||||
classes => if_repaired(php_repaired);
|
||||
classes => if_repaired(php_changed);
|
||||
|
||||
|
||||
methods:
|
||||
|
@ -143,20 +121,6 @@ reports:
|
|||
|
||||
}
|
||||
|
||||
bundle agent install_php_fpm
|
||||
{
|
||||
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"
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
bundle agent php_composer(cfg)
|
||||
{
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Path to the folder containing files
|
||||
folder_path="$1"
|
||||
|
||||
# Path to the file containing the list of filenames
|
||||
list_file="$2"
|
||||
|
||||
# Check if the folder exists
|
||||
if [ ! -d "$folder_path" ]; then
|
||||
echo "Folder does not exist: $folder_path"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if the list file exists
|
||||
if [ ! -f "$list_file" ]; then
|
||||
echo "List file does not exist: $list_file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Loop through the files in the folder
|
||||
for file_in_folder in "$folder_path"/*; do
|
||||
# Check if the current file is a regular file
|
||||
if [ -f "$file_in_folder" ]; then
|
||||
# Get the filename without the path
|
||||
filename=$(basename "$file_in_folder")
|
||||
|
||||
# Check if the filename is not in the list
|
||||
if ! grep -qFx "$filename" "$list_file"; then
|
||||
echo "Deleting: $file_in_folder"
|
||||
rm "$file_in_folder"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
!/bin/sh
|
||||
# To add this repository please do:
|
||||
|
||||
|
||||
|
||||
echo $1 $2 $3
|
||||
|
||||
echo "PARAMS $1 $2 $3"
|
||||
|
||||
if [ -n "$3" ]; then
|
||||
echo "it dollaar 3"
|
||||
curl -sSLo /usr/share/keyrings/$4 $3
|
||||
echo "deb [signed-by=/usr/share/keyrings/$4] $2 $(lsb_release -sc) main" > /etc/apt/sources.list.d/$1.list
|
||||
|
||||
else
|
||||
echo "its not $3"
|
||||
|
||||
echo "deb $2 $(lsb_release -sc) main" > /etc/apt/sources.list.d/$1.list
|
||||
|
||||
fi
|
||||
|
||||
apt-get update
|
||||
|
Loading…
Reference in New Issue