Skip to content

Commit 1b15758

Browse files
authored
Merge pull request #157 from bawuenet/master
Enable Softwarecollections on RHEL and CentOS
2 parents 5e933df + 956cee6 commit 1b15758

File tree

3 files changed

+72
-43
lines changed

3 files changed

+72
-43
lines changed

php/ng/installed.jinja

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,18 @@ php_ppa_{{ state }}:
7272

7373
{% endif %}
7474
{% endif %}
75+
{% elif grains['os_family'] == "RedHat" and (state == 'cli' or state == 'fpm' or state == 'php') %}
76+
{% set use_scl_repo = salt['pillar.get']('php:use_scl_repo', False) %}
77+
{% set scl_php_version = salt['pillar.get']('php:scl_php_version', 71) %}
78+
{% if use_scl_repo and grains['os'] == 'CentOS' %}
79+
php_centos_scl_enable_{{ state }}:
80+
pkg.installed:
81+
- name: centos-release-scl
82+
{% elif use_scl_repo and grains['os'] == 'RedHat' %}
83+
php_redhat_scl_enable_{{ state }}:
84+
cmd.run:
85+
- name: yum-config-manager --enable rhel-server-rhscl-{{ grains['osmajorrelease'] }}-rpms
86+
{% endif %}
7587
{% endif %}
7688

7789
php_install_{{ state }}:

php/ng/map.jinja

Lines changed: 54 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2490,6 +2490,17 @@
24902490
}, merge=True) %}
24912491
{%- else %}
24922492
{%- set useversion = phpng_version | replace(".", "-") -%}
2493+
{#- Red Hat Softwarecollection prefix lookup belongs to the Red Hat part
2494+
further down but has to go here due to Jinja parsing rules. -#}
2495+
{%- if salt['pillar.get']('php:use_scl_repo', False) -%}
2496+
{%- set rh_prefix = 'rh-php{}-'.format(salt['pillar.get']('php:scl_php_version', '')) -%}
2497+
{%- set sclo_prefix = 'sclo-php{}-'.format(salt['pillar.get']('php:scl_php_version', '')) -%}
2498+
{%- set path_suffix = 'opt/rh/rh-php{}/'.format(salt['pillar.get']('php:scl_php_version', '')) -%}
2499+
{%- else -%}
2500+
{%- set rh_prefix = '' -%}
2501+
{%- set sclo_prefix = '' -%}
2502+
{%- set path_suffix = '' -%}
2503+
{%- endif -%}
24932504
{%- set php = salt['pillar.get']('php:ng', {
24942505
'lookup': salt['grains.filter_by']({
24952506
'Debian': {
@@ -2692,84 +2703,84 @@
26922703
'pkgs': {
26932704
'adodb': 'php-adodb',
26942705
'apc': 'php-pecl-apc',
2695-
'apcu': 'php-pecl-apcu',
2696-
'bcmath': 'php-bcmath',
2706+
'apcu': rh_prefix + 'php-pecl-apcu',
2707+
'bcmath': rh_prefix + 'php-bcmath',
26972708
'build_pkgs': ['openssl-devel', 'gcc'],
26982709
'cache-lite': 'php-pear-Cache-Lite',
2699-
'cgi': 'php-cgi',
2700-
'cli': 'php-cli',
2710+
'cgi': rh_prefix + 'php-cgi',
2711+
'cli': rh_prefix + 'php-cli',
27012712
'composer': 'composer',
27022713
'composer_bin': 'composer',
27032714
'console-table': 'php-pear-Console-Table',
27042715
'curl': ['php-common', 'curl'],
2705-
'dev': 'php-devel',
2706-
'ext_conf_path': '/etc/php.d',
2707-
'fpm': 'php-fpm',
2708-
'gd': 'php-gd',
2709-
'geoip': 'php-pecl-geoip',
2716+
'dev': rh_prefix + 'php-devel',
2717+
'ext_conf_path': '/etc/' + path_suffix + 'php.d',
2718+
'fpm': rh_prefix + 'php-fpm',
2719+
'gd': rh_prefix + 'php-gd',
2720+
'geoip': sclo_prefix + 'php-pecl-geoip',
27102721
'geshi': 'php-geshi',
27112722
'gettext': 'php-php-gettext',
2712-
'http': 'php-pecl-http',
2713-
'imagick': 'php-pecl-imagick',
2714-
'imap': 'php-imap',
2715-
'intl': 'php-intl',
2716-
'json': 'php-common',
2717-
'ldap': 'php-ldap',
2723+
'http': sclo_prefix + 'php-pecl-http',
2724+
'imagick': sclo_prefix + 'php-pecl-imagick',
2725+
'imap': sclo_prefix + 'php-imap',
2726+
'intl': rh_prefix + 'php-intl',
2727+
'json': rh_prefix + 'php-common',
2728+
'ldap': rh_prefix + 'php-ldap',
27182729
'local_bin': '/usr/local/bin',
27192730
'auth-sasl': 'php-pear-Auth-SASL',
27202731
'mail': 'php-pear-Mail',
2721-
'mbstring': 'php-mbstring',
2722-
'mcrypt': 'php-mcrypt',
2732+
'mbstring': rh_prefix + 'php-mbstring',
2733+
'mcrypt': sclo_prefix + 'php-mcrypt',
27232734
'memcache': 'php-pecl-memcache',
2724-
'memcached': 'php-pecl-memcached',
2735+
'memcached': sclo_prefix + 'php-pecl-memcached',
27252736
'mysql': 'php-mysql',
2726-
'mysqlnd': 'php-mysqlnd',
2737+
'mysqlnd': rh_prefix + 'php-mysqlnd',
27272738
'net-smtp': 'php-pear-Net-SMTP',
27282739
'net4': 'php-pear-Net-IPv4',
27292740
'oauth': 'php-pecl-oauth',
27302741
'opcache': 'php-pecl-zendopcache',
2731-
'pear': 'php-pear',
2732-
'pgsql': 'php-pgsql',
2733-
'php': 'php',
2734-
'pspell': 'php-pspell',
2735-
'redis': 'php-pecl-redis',
2742+
'pear': rh_prefix + 'php-pear',
2743+
'pgsql': rh_prefix + 'php-pgsql',
2744+
'php': rh_prefix + 'php',
2745+
'pspell': rh_prefix + 'php-pspell',
2746+
'redis': sclo_prefix + 'php-pecl-redis',
27362747
'seclib': 'php-phpseclib',
2737-
'snmp': 'php-snmp',
2738-
'soap': 'php-soap',
2739-
'sqlite': 'php-pdo',
2740-
'ssh2': 'php-pecl-ssh2',
2748+
'snmp': rh_prefix + 'php-snmp',
2749+
'soap': rh_prefix + 'php-soap',
2750+
'sqlite': rh_prefix + 'php-pdo',
2751+
'ssh2': sclo_prefix + 'php-pecl-ssh2',
27412752
'suhosin5_ext': 'suhosin.so',
27422753
'suhosin5_repo': 'https://github.com/sektioneins/suhosin',
27432754
'suhosin7_ext': 'suhosin7.so',
27442755
'suhosin7_repo': 'https://github.com/sektioneins/suhosin7',
27452756
'tcpdf': 'php-tcpdf',
27462757
'temp_dir': '/tmp',
2747-
'tidy': 'php-tidy',
2748-
'uuid': 'php-pecl-uuid',
2758+
'tidy': sclo_prefix + 'php-tidy',
2759+
'uuid': sclo_prefix + 'php-pecl-uuid',
27492760
'xcache': 'php-xcache',
2750-
'xdebug': 'php-pecl-xdebug',
2751-
'xml': 'php-xml',
2752-
'xsl': 'php-xml',
2753-
'zip': 'php',
2761+
'xdebug': sclo_prefix + 'php-pecl-xdebug',
2762+
'xml': rh_prefix + 'php-xml',
2763+
'xsl': rh_prefix + 'php-xml',
2764+
'zip': rh_prefix + 'php',
27542765
},
27552766
'fpm': {
2756-
'conf': '/etc/php-fpm.conf',
2757-
'ini': '/etc/php.ini',
2758-
'pools': '/etc/php-fpm.d',
2759-
'service': 'php-fpm',
2767+
'conf': '/etc/' + path_suffix + 'php-fpm.conf',
2768+
'ini': '/etc/' + path_suffix + 'php.ini',
2769+
'pools': '/etc/' + path_suffix + 'php-fpm.d',
2770+
'service': rh_prefix + 'php-fpm',
27602771
'defaults': {
27612772
'global': {
2762-
'pid': '/var/run/php-fpm/php-fpm.pid',
2763-
'error_log': '/var/log/php-fpm/error.log',
2773+
'pid': '/var/' + path_suffix + 'run/php-fpm/php-fpm.pid',
2774+
'error_log': '/var/' + path_suffix + 'log/php-fpm/error.log',
27642775
},
2765-
'include': '/etc/php-fpm.d/*.conf',
2776+
'include': '/etc/' + path_suffix + 'php-fpm.d/*.conf',
27662777
},
27672778
},
27682779
'cli': {
2769-
'ini': '/etc/php.ini',
2780+
'ini': '/etc/' + path_suffix + 'php.ini',
27702781
},
27712782
'xcache': {
2772-
'ini': '/etc/php.d/xcache.ini',
2783+
'ini': '/etc/' + path_suffix + 'php.d/xcache.ini',
27732784
},
27742785
},
27752786
'Suse': {

pillar.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ php:
55
use_external_repo: True
66
# Set the external repository name (valid only if use_external_repo is not none)
77
external_repo_name: 'ondrej/php'
8+
# Use Software Collections Repository offering PHP 5.4, 5.5, 5.6, 7.0 and 7.1
9+
# https://www.softwarecollections.org/en/ for more information.
10+
# SCL is only supported on RHEL and CentOS and only active when using php.ng
11+
use_scl_repo: True
12+
# Which PHP version from the SCL repos to use
13+
scl_php_version: 71
814
# Set the MongoDB driver version. You can specify (optionally) the driver version
915
# when you add the php.mongo formula to your execution list
1016
mongo_version: "1.5.5"

0 commit comments

Comments
 (0)