Use remi repos and dnf switch-to for php

This commit is contained in:
Tobias Herre 2023-10-29 02:09:46 +02:00
parent 26a000a947
commit 2af67ae49c
1 changed files with 74 additions and 21 deletions

95
php.cf
View File

@ -5,7 +5,8 @@
bundle agent install_php
{
classes:
"php_install_repo" expression => not(fileexists("/etc/apt/sources.list.d/php.list"));
"use_ext_repos";
vars:
"version" string => "$(php.version)";
centos::
@ -63,22 +64,23 @@ vars:
};
centos::
"xversion" string => "";
"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$(xversion)-cli",
"php$(xversion)-common",
"php$(xversion)-pecl-zip",
"php$(xversion)-pgsql",
"php$(xversion)-mysqlnd",
"php$(xversion)-xml",
"php$(xversion)-gd",
"php$(xversion)-mbstring",
"php$(xversion)-intl",
"php$(xversion)-pecl-imagick-im6",
"php$(xversion)-ldap",
"php-pecl-json-post"
};
# "php$(version)-curl",
commands:
# (debian|ubuntu)&php_install_repo::
@ -94,11 +96,62 @@ commands:
methods:
"any" usebundle => install_apt_repo("php","$(php.apt_repo_url)","$(php.apt_repo_key)","$(php.apt_repo_key_name)"),
handle => "php_repo_ready";
debian&use_ext_repos::
"any" usebundle => install_apt_repo("php","$(php.apt_repo_url)","$(php.apt_repo_key)","$(php.apt_repo_key_name)"),
handle => "php_repo_ready";
centos::
"any" usebundle => php_install_centos_repos,
handle => "php_repo_ready";
any::
"any" usebundle => wmde_install_packages(@(pkgs),"php"),
depends_on => {"php_repo_ready"};
commands:
}
bundle agent php_install_centos_repos
{
classes:
centos::
"switch_repo" expression => not(returnszero("cat /etc/dnf/modules.d/php.module | grep -q '^stream.*=.*remi-$(php.version)'","useshell"));
"install_remi" expression => not(returnszero("rpm -q remi-release > /dev/null","useshell"));
"install_epel" expression => not(returnszero("rpm -q epel-release > /dev/null","useshell"));
commands:
centos&install_epel::
"/usr/bin/yum"
args => "install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm",
handle => "php_epel_repo_installed";
centos&(!install_epel)::
"/usr/bin/true"
inform => "false",
handle => "php_epel_repo_installed";
centos&install_remi::
"/usr/bin/yum"
args => "install -y https://rpms.remirepo.net/enterprise/remi-release-$(sys.os_version_major).rpm",
depends_on => {"php_epel_repo_installed"},
handle => "php_remi_repo_installed";
centos&(!install_remi)::
"/usr/bin/true"
inform => "false",
handle => "php_remi_repo_installed";
centos&switch_repo::
"dnf" args => "module switch-to php:remi-$(php.version) -y",
contain => wmde_cmd_useshell,
depends_on => {"php_remi_repo_installed"};
methods:
}
bundle agent php(settings)
@ -109,8 +162,8 @@ 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/$(php.version)/apache2/php.ini",
# "/etc/php/$(php.version)/fpm/php.ini"
};
"cli_exe" string => "/usr/bin/php";
@ -148,8 +201,8 @@ vars:
centos::
"cli_exe" string => "/usr/bin/php";
"version" string => "";
"fpm_pkgs" slist => { "php$(version)-fpm" };
"version" string => "8.2";
"fpm_pkgs" slist => { "php-fpm" };
"fpm_service_name" string => "php$(version)-fpm";
"fpm_socket" string => "/run/php-fpm/www.sock";
@ -163,8 +216,8 @@ files:
classes => if_repaired(php_repaired);
methods:
"any" usebundle => install_php;
#methods:
# "any" usebundle => install_php;
reports:
"PHP VERSION: $(ini_files) V:$(install_php.version)";