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.
This commit is contained in:
parent
5e933df525
commit
956cee6f69
@ -72,6 +72,18 @@ php_ppa_{{ state }}:
|
|||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% 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 %}
|
{% endif %}
|
||||||
|
|
||||||
php_install_{{ state }}:
|
php_install_{{ state }}:
|
||||||
|
@ -2490,6 +2490,17 @@
|
|||||||
}, merge=True) %}
|
}, merge=True) %}
|
||||||
{%- else %}
|
{%- else %}
|
||||||
{%- set useversion = phpng_version | replace(".", "-") -%}
|
{%- 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', {
|
{%- set php = salt['pillar.get']('php:ng', {
|
||||||
'lookup': salt['grains.filter_by']({
|
'lookup': salt['grains.filter_by']({
|
||||||
'Debian': {
|
'Debian': {
|
||||||
@ -2692,84 +2703,84 @@
|
|||||||
'pkgs': {
|
'pkgs': {
|
||||||
'adodb': 'php-adodb',
|
'adodb': 'php-adodb',
|
||||||
'apc': 'php-pecl-apc',
|
'apc': 'php-pecl-apc',
|
||||||
'apcu': 'php-pecl-apcu',
|
'apcu': rh_prefix + 'php-pecl-apcu',
|
||||||
'bcmath': 'php-bcmath',
|
'bcmath': rh_prefix + 'php-bcmath',
|
||||||
'build_pkgs': ['openssl-devel', 'gcc'],
|
'build_pkgs': ['openssl-devel', 'gcc'],
|
||||||
'cache-lite': 'php-pear-Cache-Lite',
|
'cache-lite': 'php-pear-Cache-Lite',
|
||||||
'cgi': 'php-cgi',
|
'cgi': rh_prefix + 'php-cgi',
|
||||||
'cli': 'php-cli',
|
'cli': rh_prefix + 'php-cli',
|
||||||
'composer': 'composer',
|
'composer': 'composer',
|
||||||
'composer_bin': 'composer',
|
'composer_bin': 'composer',
|
||||||
'console-table': 'php-pear-Console-Table',
|
'console-table': 'php-pear-Console-Table',
|
||||||
'curl': ['php-common', 'curl'],
|
'curl': ['php-common', 'curl'],
|
||||||
'dev': 'php-devel',
|
'dev': rh_prefix + 'php-devel',
|
||||||
'ext_conf_path': '/etc/php.d',
|
'ext_conf_path': '/etc/' + path_suffix + 'php.d',
|
||||||
'fpm': 'php-fpm',
|
'fpm': rh_prefix + 'php-fpm',
|
||||||
'gd': 'php-gd',
|
'gd': rh_prefix + 'php-gd',
|
||||||
'geoip': 'php-pecl-geoip',
|
'geoip': sclo_prefix + 'php-pecl-geoip',
|
||||||
'geshi': 'php-geshi',
|
'geshi': 'php-geshi',
|
||||||
'gettext': 'php-php-gettext',
|
'gettext': 'php-php-gettext',
|
||||||
'http': 'php-pecl-http',
|
'http': sclo_prefix + 'php-pecl-http',
|
||||||
'imagick': 'php-pecl-imagick',
|
'imagick': sclo_prefix + 'php-pecl-imagick',
|
||||||
'imap': 'php-imap',
|
'imap': sclo_prefix + 'php-imap',
|
||||||
'intl': 'php-intl',
|
'intl': rh_prefix + 'php-intl',
|
||||||
'json': 'php-common',
|
'json': rh_prefix + 'php-common',
|
||||||
'ldap': 'php-ldap',
|
'ldap': rh_prefix + 'php-ldap',
|
||||||
'local_bin': '/usr/local/bin',
|
'local_bin': '/usr/local/bin',
|
||||||
'auth-sasl': 'php-pear-Auth-SASL',
|
'auth-sasl': 'php-pear-Auth-SASL',
|
||||||
'mail': 'php-pear-Mail',
|
'mail': 'php-pear-Mail',
|
||||||
'mbstring': 'php-mbstring',
|
'mbstring': rh_prefix + 'php-mbstring',
|
||||||
'mcrypt': 'php-mcrypt',
|
'mcrypt': sclo_prefix + 'php-mcrypt',
|
||||||
'memcache': 'php-pecl-memcache',
|
'memcache': 'php-pecl-memcache',
|
||||||
'memcached': 'php-pecl-memcached',
|
'memcached': sclo_prefix + 'php-pecl-memcached',
|
||||||
'mysql': 'php-mysql',
|
'mysql': 'php-mysql',
|
||||||
'mysqlnd': 'php-mysqlnd',
|
'mysqlnd': rh_prefix + 'php-mysqlnd',
|
||||||
'net-smtp': 'php-pear-Net-SMTP',
|
'net-smtp': 'php-pear-Net-SMTP',
|
||||||
'net4': 'php-pear-Net-IPv4',
|
'net4': 'php-pear-Net-IPv4',
|
||||||
'oauth': 'php-pecl-oauth',
|
'oauth': 'php-pecl-oauth',
|
||||||
'opcache': 'php-pecl-zendopcache',
|
'opcache': 'php-pecl-zendopcache',
|
||||||
'pear': 'php-pear',
|
'pear': rh_prefix + 'php-pear',
|
||||||
'pgsql': 'php-pgsql',
|
'pgsql': rh_prefix + 'php-pgsql',
|
||||||
'php': 'php',
|
'php': rh_prefix + 'php',
|
||||||
'pspell': 'php-pspell',
|
'pspell': rh_prefix + 'php-pspell',
|
||||||
'redis': 'php-pecl-redis',
|
'redis': sclo_prefix + 'php-pecl-redis',
|
||||||
'seclib': 'php-phpseclib',
|
'seclib': 'php-phpseclib',
|
||||||
'snmp': 'php-snmp',
|
'snmp': rh_prefix + 'php-snmp',
|
||||||
'soap': 'php-soap',
|
'soap': rh_prefix + 'php-soap',
|
||||||
'sqlite': 'php-pdo',
|
'sqlite': rh_prefix + 'php-pdo',
|
||||||
'ssh2': 'php-pecl-ssh2',
|
'ssh2': sclo_prefix + 'php-pecl-ssh2',
|
||||||
'suhosin5_ext': 'suhosin.so',
|
'suhosin5_ext': 'suhosin.so',
|
||||||
'suhosin5_repo': 'https://github.com/sektioneins/suhosin',
|
'suhosin5_repo': 'https://github.com/sektioneins/suhosin',
|
||||||
'suhosin7_ext': 'suhosin7.so',
|
'suhosin7_ext': 'suhosin7.so',
|
||||||
'suhosin7_repo': 'https://github.com/sektioneins/suhosin7',
|
'suhosin7_repo': 'https://github.com/sektioneins/suhosin7',
|
||||||
'tcpdf': 'php-tcpdf',
|
'tcpdf': 'php-tcpdf',
|
||||||
'temp_dir': '/tmp',
|
'temp_dir': '/tmp',
|
||||||
'tidy': 'php-tidy',
|
'tidy': sclo_prefix + 'php-tidy',
|
||||||
'uuid': 'php-pecl-uuid',
|
'uuid': sclo_prefix + 'php-pecl-uuid',
|
||||||
'xcache': 'php-xcache',
|
'xcache': 'php-xcache',
|
||||||
'xdebug': 'php-pecl-xdebug',
|
'xdebug': sclo_prefix + 'php-pecl-xdebug',
|
||||||
'xml': 'php-xml',
|
'xml': rh_prefix + 'php-xml',
|
||||||
'xsl': 'php-xml',
|
'xsl': rh_prefix + 'php-xml',
|
||||||
'zip': 'php',
|
'zip': rh_prefix + 'php',
|
||||||
},
|
},
|
||||||
'fpm': {
|
'fpm': {
|
||||||
'conf': '/etc/php-fpm.conf',
|
'conf': '/etc/' + path_suffix + 'php-fpm.conf',
|
||||||
'ini': '/etc/php.ini',
|
'ini': '/etc/' + path_suffix + 'php.ini',
|
||||||
'pools': '/etc/php-fpm.d',
|
'pools': '/etc/' + path_suffix + 'php-fpm.d',
|
||||||
'service': 'php-fpm',
|
'service': rh_prefix + 'php-fpm',
|
||||||
'defaults': {
|
'defaults': {
|
||||||
'global': {
|
'global': {
|
||||||
'pid': '/var/run/php-fpm/php-fpm.pid',
|
'pid': '/var/' + path_suffix + 'run/php-fpm/php-fpm.pid',
|
||||||
'error_log': '/var/log/php-fpm/error.log',
|
'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': {
|
'cli': {
|
||||||
'ini': '/etc/php.ini',
|
'ini': '/etc/' + path_suffix + 'php.ini',
|
||||||
},
|
},
|
||||||
'xcache': {
|
'xcache': {
|
||||||
'ini': '/etc/php.d/xcache.ini',
|
'ini': '/etc/' + path_suffix + 'php.d/xcache.ini',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'Suse': {
|
'Suse': {
|
||||||
|
@ -5,6 +5,12 @@ php:
|
|||||||
use_external_repo: True
|
use_external_repo: True
|
||||||
# Set the external repository name (valid only if use_external_repo is not none)
|
# Set the external repository name (valid only if use_external_repo is not none)
|
||||||
external_repo_name: 'ondrej/php'
|
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
|
# Set the MongoDB driver version. You can specify (optionally) the driver version
|
||||||
# when you add the php.mongo formula to your execution list
|
# when you add the php.mongo formula to your execution list
|
||||||
mongo_version: "1.5.5"
|
mongo_version: "1.5.5"
|
||||||
|
Loading…
Reference in New Issue
Block a user