218 lines
4.9 KiB
CFEngine3
218 lines
4.9 KiB
CFEngine3
#
|
|
#
|
|
#
|
|
|
|
bundle agent install_php
|
|
{
|
|
classes:
|
|
"php_install_repo" expression => not(fileexists("/etc/apt/sources.list.d/php.list"));
|
|
vars:
|
|
"version" string => "$(php.version)";
|
|
centos::
|
|
"version" string => "";
|
|
|
|
|
|
freebsd::
|
|
|
|
freebsd::
|
|
"pkgs" slist => {
|
|
"php$(php.bsdvs)-session",
|
|
"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$(bsdvs)-json",
|
|
|
|
|
|
debian::
|
|
"pkgs" slist => {
|
|
"php$(version)-cli",
|
|
"php$(version)-common",
|
|
"php$(version)-zip",
|
|
"php$(version)-pgsql",
|
|
"php$(version)-mysql",
|
|
"php$(version)-xml",
|
|
"php$(version)-gd",
|
|
"php$(version)-mbstring",
|
|
"php$(version)-intl",
|
|
"php$(version)-curl",
|
|
"php$(version)-imagick",
|
|
"php$(version)-ldap",
|
|
"php-json"
|
|
|
|
};
|
|
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",
|
|
};
|
|
|
|
centos::
|
|
"pkgs" slist => {
|
|
"php$(version)-cli",
|
|
"php$(version)-common",
|
|
"php$(version)-pecl-zip",
|
|
"php$(version)-pgsql",
|
|
"php$(version)-mysqlnd",
|
|
"php$(version)-xml",
|
|
"php$(version)-gd",
|
|
"php$(version)-mbstring",
|
|
"php$(version)-intl",
|
|
"php$(version)-pecl-imagick",
|
|
"php$(version)-ldap",
|
|
"php-pecl-json-post"
|
|
|
|
};
|
|
# "php$(version)-curl",
|
|
|
|
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"};
|
|
}
|
|
|
|
bundle agent php(settings)
|
|
{
|
|
vars:
|
|
"ini_files" slist => { };
|
|
|
|
debian::
|
|
"version" string => "8.0";
|
|
"ini_files" slist => {
|
|
"/etc/php/$(php.version)/apache2/php.ini",
|
|
"/etc/php/$(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",
|
|
"/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";
|
|
|
|
centos::
|
|
"cli_exe" string => "/usr/bin/php";
|
|
"version" string => "";
|
|
"fpm_pkgs" slist => { "php$(version)-fpm" };
|
|
"fpm_service_name" string => "php$(version)-fpm";
|
|
"fpm_socket" string => "/run/php-fpm/www.sock";
|
|
|
|
|
|
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_repaired);
|
|
|
|
|
|
methods:
|
|
"any" usebundle => install_php;
|
|
reports:
|
|
"PHP VERSION: $(ini_files) V:$(install_php.version)";
|
|
|
|
}
|
|
|
|
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)
|
|
{
|
|
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;
|
|
}
|