Просмотр исходного кода

Enable Softwarecollections on RHEL and CentOS

As RHEL and CentOS are both longer-lived enterprise-class operating
systems the software versions are usually lagging a bit behind.

In case one wants the longevity of an Enterprise Linux together with
more modern software the Softwarecollections project exists which
offers amongst others more modern PHP releases.

This commit adds a pillar toggle to use the SCL repo and the ability
to select which php version to install.
tags/v0.34.0
Andreas Thienemann 6 лет назад
Родитель
Сommit
956cee6f69
3 измененных файлов: 72 добавлений и 43 удалений
  1. +12
    -0
      php/ng/installed.jinja
  2. +54
    -43
      php/ng/map.jinja
  3. +6
    -0
      pillar.example

+ 12
- 0
php/ng/installed.jinja Просмотреть файл

@@ -72,6 +72,18 @@ php_ppa_{{ state }}:

{% endif %}
{% endif %}
{% elif grains['os_family'] == "RedHat" and (state == 'cli' or state == 'fpm' or state == 'php') %}
{% set use_scl_repo = salt['pillar.get']('php:use_scl_repo', False) %}
{% set scl_php_version = salt['pillar.get']('php:scl_php_version', 71) %}
{% if use_scl_repo and grains['os'] == 'CentOS' %}
php_centos_scl_enable_{{ state }}:
pkg.installed:
- name: centos-release-scl
{% elif use_scl_repo and grains['os'] == 'RedHat' %}
php_redhat_scl_enable_{{ state }}:
cmd.run:
- name: yum-config-manager --enable rhel-server-rhscl-{{ grains['osmajorrelease'] }}-rpms
{% endif %}
{% endif %}

php_install_{{ state }}:

+ 54
- 43
php/ng/map.jinja Просмотреть файл

@@ -2490,6 +2490,17 @@
}, merge=True) %}
{%- else %}
{%- set useversion = phpng_version | replace(".", "-") -%}
{#- Red Hat Softwarecollection prefix lookup belongs to the Red Hat part
further down but has to go here due to Jinja parsing rules. -#}
{%- if salt['pillar.get']('php:use_scl_repo', False) -%}
{%- set rh_prefix = 'rh-php{}-'.format(salt['pillar.get']('php:scl_php_version', '')) -%}
{%- set sclo_prefix = 'sclo-php{}-'.format(salt['pillar.get']('php:scl_php_version', '')) -%}
{%- set path_suffix = 'opt/rh/rh-php{}/'.format(salt['pillar.get']('php:scl_php_version', '')) -%}
{%- else -%}
{%- set rh_prefix = '' -%}
{%- set sclo_prefix = '' -%}
{%- set path_suffix = '' -%}
{%- endif -%}
{%- set php = salt['pillar.get']('php:ng', {
'lookup': salt['grains.filter_by']({
'Debian': {
@@ -2692,84 +2703,84 @@
'pkgs': {
'adodb': 'php-adodb',
'apc': 'php-pecl-apc',
'apcu': 'php-pecl-apcu',
'bcmath': 'php-bcmath',
'apcu': rh_prefix + 'php-pecl-apcu',
'bcmath': rh_prefix + 'php-bcmath',
'build_pkgs': ['openssl-devel', 'gcc'],
'cache-lite': 'php-pear-Cache-Lite',
'cgi': 'php-cgi',
'cli': 'php-cli',
'cgi': rh_prefix + 'php-cgi',
'cli': rh_prefix + 'php-cli',
'composer': 'composer',
'composer_bin': 'composer',
'console-table': 'php-pear-Console-Table',
'curl': ['php-common', 'curl'],
'dev': 'php-devel',
'ext_conf_path': '/etc/php.d',
'fpm': 'php-fpm',
'gd': 'php-gd',
'geoip': 'php-pecl-geoip',
'dev': rh_prefix + 'php-devel',
'ext_conf_path': '/etc/' + path_suffix + 'php.d',
'fpm': rh_prefix + 'php-fpm',
'gd': rh_prefix + 'php-gd',
'geoip': sclo_prefix + 'php-pecl-geoip',
'geshi': 'php-geshi',
'gettext': 'php-php-gettext',
'http': 'php-pecl-http',
'imagick': 'php-pecl-imagick',
'imap': 'php-imap',
'intl': 'php-intl',
'json': 'php-common',
'ldap': 'php-ldap',
'http': sclo_prefix + 'php-pecl-http',
'imagick': sclo_prefix + 'php-pecl-imagick',
'imap': sclo_prefix + 'php-imap',
'intl': rh_prefix + 'php-intl',
'json': rh_prefix + 'php-common',
'ldap': rh_prefix + 'php-ldap',
'local_bin': '/usr/local/bin',
'auth-sasl': 'php-pear-Auth-SASL',
'mail': 'php-pear-Mail',
'mbstring': 'php-mbstring',
'mcrypt': 'php-mcrypt',
'mbstring': rh_prefix + 'php-mbstring',
'mcrypt': sclo_prefix + 'php-mcrypt',
'memcache': 'php-pecl-memcache',
'memcached': 'php-pecl-memcached',
'memcached': sclo_prefix + 'php-pecl-memcached',
'mysql': 'php-mysql',
'mysqlnd': 'php-mysqlnd',
'mysqlnd': rh_prefix + 'php-mysqlnd',
'net-smtp': 'php-pear-Net-SMTP',
'net4': 'php-pear-Net-IPv4',
'oauth': 'php-pecl-oauth',
'opcache': 'php-pecl-zendopcache',
'pear': 'php-pear',
'pgsql': 'php-pgsql',
'php': 'php',
'pspell': 'php-pspell',
'redis': 'php-pecl-redis',
'pear': rh_prefix + 'php-pear',
'pgsql': rh_prefix + 'php-pgsql',
'php': rh_prefix + 'php',
'pspell': rh_prefix + 'php-pspell',
'redis': sclo_prefix + 'php-pecl-redis',
'seclib': 'php-phpseclib',
'snmp': 'php-snmp',
'soap': 'php-soap',
'sqlite': 'php-pdo',
'ssh2': 'php-pecl-ssh2',
'snmp': rh_prefix + 'php-snmp',
'soap': rh_prefix + 'php-soap',
'sqlite': rh_prefix + 'php-pdo',
'ssh2': sclo_prefix + 'php-pecl-ssh2',
'suhosin5_ext': 'suhosin.so',
'suhosin5_repo': 'https://github.com/sektioneins/suhosin',
'suhosin7_ext': 'suhosin7.so',
'suhosin7_repo': 'https://github.com/sektioneins/suhosin7',
'tcpdf': 'php-tcpdf',
'temp_dir': '/tmp',
'tidy': 'php-tidy',
'uuid': 'php-pecl-uuid',
'tidy': sclo_prefix + 'php-tidy',
'uuid': sclo_prefix + 'php-pecl-uuid',
'xcache': 'php-xcache',
'xdebug': 'php-pecl-xdebug',
'xml': 'php-xml',
'xsl': 'php-xml',
'zip': 'php',
'xdebug': sclo_prefix + 'php-pecl-xdebug',
'xml': rh_prefix + 'php-xml',
'xsl': rh_prefix + 'php-xml',
'zip': rh_prefix + 'php',
},
'fpm': {
'conf': '/etc/php-fpm.conf',
'ini': '/etc/php.ini',
'pools': '/etc/php-fpm.d',
'service': 'php-fpm',
'conf': '/etc/' + path_suffix + 'php-fpm.conf',
'ini': '/etc/' + path_suffix + 'php.ini',
'pools': '/etc/' + path_suffix + 'php-fpm.d',
'service': rh_prefix + 'php-fpm',
'defaults': {
'global': {
'pid': '/var/run/php-fpm/php-fpm.pid',
'error_log': '/var/log/php-fpm/error.log',
'pid': '/var/' + path_suffix + 'run/php-fpm/php-fpm.pid',
'error_log': '/var/' + path_suffix + 'log/php-fpm/error.log',
},
'include': '/etc/php-fpm.d/*.conf',
'include': '/etc/' + path_suffix + 'php-fpm.d/*.conf',
},
},
'cli': {
'ini': '/etc/php.ini',
'ini': '/etc/' + path_suffix + 'php.ini',
},
'xcache': {
'ini': '/etc/php.d/xcache.ini',
'ini': '/etc/' + path_suffix + 'php.d/xcache.ini',
},
},
'Suse': {

+ 6
- 0
pillar.example Просмотреть файл

@@ -5,6 +5,12 @@ php:
use_external_repo: True
# Set the external repository name (valid only if use_external_repo is not none)
external_repo_name: 'ondrej/php'
# Use Software Collections Repository offering PHP 5.4, 5.5, 5.6, 7.0 and 7.1
# https://www.softwarecollections.org/en/ for more information.
# SCL is only supported on RHEL and CentOS and only active when using php.ng
use_scl_repo: True
# Which PHP version from the SCL repos to use
scl_php_version: 71
# Set the MongoDB driver version. You can specify (optionally) the driver version
# when you add the php.mongo formula to your execution list
mongo_version: "1.5.5"

Загрузка…
Отмена
Сохранить