diff --git a/php.cf b/php.cf index 4444b67..a578828 100644 --- a/php.cf +++ b/php.cf @@ -4,19 +4,12 @@ bundle agent install_php { +classes: + "php_install_repo" expression => not(fileexists("/etc/apt/sources.list.d/php.list")); 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:: freebsd:: "cli_exe" string => "/usr/local/bin/php"; @@ -39,19 +32,19 @@ vars: debian:: "pkgs" slist => { - "php-cli", + "php$(version)-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", + "php$(version)-gd", + "php$(version)-mbstring", + "php$(version)-intl", + "php$(version)-curl", + "php$(version)-imagick", + "php$(version)-ldap", + "php-json" }; ubuntu:: @@ -68,31 +61,55 @@ vars: }; -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); +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: + debian:: + "version" string => "8.2"; "ini_files" slist => { - "/etc/php/$(install_php.version)/apache2/php.ini", - "/etc/php/$(install_php.version)/fpm/php.ini" + "/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"; + + "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"; + 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", @@ -121,6 +138,20 @@ 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_repaired"), + depends_on =>{ + "php_fpm_pkgs_installed", + "php_pkgs_installed" + }; +} + bundle agent php_composer(cfg) {