150 lines
2.9 KiB
CFEngine3
150 lines
2.9 KiB
CFEngine3
#
|
|
#
|
|
#
|
|
|
|
bundle agent install_php
|
|
{
|
|
vars:
|
|
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";
|
|
"pkgs" slist => {
|
|
"php$(bsdvs)-session",
|
|
"php$(bsdvs)-zip",
|
|
"php$(bsdvs)-pgsql",
|
|
"php$(bsdvs)-mysqli",
|
|
"php$(bsdvs)-pdo_mysql",
|
|
"php$(bsdvs)-pdo",
|
|
"php$(bsdvs)-filter",
|
|
};
|
|
# "php$(bsdvs)-json",
|
|
|
|
|
|
debian::
|
|
"pkgs" slist => {
|
|
"php-cli",
|
|
"php$(version)-common",
|
|
"php$(version)-zip",
|
|
"php$(version)-pgsql",
|
|
"php$(version)-mysql",
|
|
"php-json",
|
|
"php$(version)-xml",
|
|
"php-gd",
|
|
"php-mbstring",
|
|
"php-intl",
|
|
"php-curl",
|
|
"php-imagick",
|
|
"php-ldap",
|
|
|
|
};
|
|
ubuntu::
|
|
"pkgs" slist => {
|
|
"php$(version)-common",
|
|
"php$(version)-zip",
|
|
"php$(version)-pgsql",
|
|
"php$(version)-mysql",
|
|
"php$(version)-xml",
|
|
"php$(version)-mbstring",
|
|
"php-geshi",
|
|
"php-json",
|
|
"php-gd",
|
|
};
|
|
|
|
|
|
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::
|
|
"ini_files" slist => {
|
|
"/etc/php/$(install_php.version)/apache2/php.ini",
|
|
"/etc/php/$(install_php.version)/fpm/php.ini"
|
|
};
|
|
|
|
"cli_exe" string => "/usr/bin/php";
|
|
|
|
freebsd::
|
|
"ini_files" slist => {
|
|
"/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";
|
|
|
|
|
|
files:
|
|
"$(ini_files)"
|
|
create => "true",
|
|
edit_template => "$(sys.workdir)/inputs/$(wmde_libdir)/templates/php.ini.mustache",
|
|
template_method => "mustache",
|
|
template_data => @(settings),
|
|
classes => if_repaired(php_changed);
|
|
|
|
|
|
methods:
|
|
"any" usebundle => install_php;
|
|
reports:
|
|
"PHP VERSION: $(ini_files) V:$(install_php.version)";
|
|
|
|
}
|
|
|
|
|
|
bundle agent php_composer(cfg)
|
|
{
|
|
vars:
|
|
"installer" string => "$(sys.workdir)/data/php/composer-setup.php";
|
|
"exe" string => "/usr/local/bin/composer";
|
|
classes:
|
|
"php_composer_install" expression => not(fileexists("$(exe)"));
|
|
|
|
vars:
|
|
|
|
|
|
files:
|
|
"$(sys.workdir)/data/php/."
|
|
create => "true",
|
|
handle => "php_dir_created";
|
|
commands:
|
|
php_composer_install::
|
|
"$(wget.exe) -q -O $(installer) https://getcomposer.org/installer"
|
|
handle => "php_composer_installer_downloaded",
|
|
depends_on => {"php_dir_created"};
|
|
|
|
"$(php.cli_exe) $(installer) --install-dir=/usr/local/bin --filename=composer"
|
|
handle => "php_composer_installed",
|
|
depends_on => {"php_composer_installer_downloaded"};
|
|
|
|
|
|
methods:
|
|
"any" usebundle => install_php;
|
|
"any" usebundle => install_wget;
|
|
}
|