From 918a873c3a903fecb0a3b1278ff75fd0d1fe81af Mon Sep 17 00:00:00 2001 From: Lebedev Vadim Date: Thu, 21 Jul 2016 10:29:28 +0300 Subject: [PATCH 1/2] * add support php7 --- manifests/augeas.pp | 2 +- manifests/mod.pp | 25 +++++++++++++++++++------ manifests/params.pp | 5 ++++- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/manifests/augeas.pp b/manifests/augeas.pp index d68239f..1c54297 100644 --- a/manifests/augeas.pp +++ b/manifests/augeas.pp @@ -58,7 +58,7 @@ $value = '', ) { - include php +# include php $service = $php::service diff --git a/manifests/mod.pp b/manifests/mod.pp index e653a73..d6494cb 100644 --- a/manifests/mod.pp +++ b/manifests/mod.pp @@ -38,15 +38,28 @@ define php::mod ( $disable = false, $service_autorestart = '', - $path = '/usr/bin:/bin:/usr/sbin:/sbin' - ) { + $path = '/usr/bin:/bin:/usr/sbin:/sbin', + $version = '5', +) { - include php +# include php + case $version { + '7': { + $php_mod_enable = 'phpenmod' + $php_mod_disable = 'phpdismod' + $pkg_fpm = 'php7.0-fpm' + } + default: { + $php_mod_enable = 'php5enmod' + $php_mod_disable = 'php5dismod' + $pkg_fpm = 'php5-fpm' + } + } if $disable { - $php_mod_tool = 'php5dismod' + $php_mod_tool = $php_mod_disable } else { - $php_mod_tool = 'php5enmod' + $php_mod_tool = $php_mod_enable } $real_service_autorestart = $service_autorestart ? { @@ -62,7 +75,7 @@ command => "${php_mod_tool} ${name}", path => $path, notify => $real_service_autorestart, - require => Package['php'], + require => Package[ $pkg_fpm ], } } diff --git a/manifests/params.pp b/manifests/params.pp index c520892..c4f544b 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -14,12 +14,15 @@ # class php::params { + if ($::lsbdistrelease == '16.04') { + $package_devel = 'php-dev' + } else { $package_devel = $::operatingsystem ? { /(?i:Ubuntu|Debian|Mint)/ => 'php5-dev', /(?i:SLES|OpenSuSe)/ => 'php5-devel', default => 'php-devel', } - + } $package_pear = $::operatingsystem ? { /(?i:Ubuntu|Debian|Mint)/ => 'php-pear', /(?i:SLES|OpenSuSe)/ => 'php5-pear', From 38ae861b6cd2ef421d505c2fc29b9d439a42b10b Mon Sep 17 00:00:00 2001 From: Lebedev Vadim Date: Thu, 21 Jul 2016 14:12:50 +0300 Subject: [PATCH 2/2] * parametrized phpquery & package_devel, fix syntax, remove debug --- manifests/augeas.pp | 2 +- manifests/mod.pp | 8 +++++--- manifests/params.pp | 10 +++++----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/manifests/augeas.pp b/manifests/augeas.pp index 1c54297..d68239f 100644 --- a/manifests/augeas.pp +++ b/manifests/augeas.pp @@ -58,7 +58,7 @@ $value = '', ) { -# include php + include php $service = $php::service diff --git a/manifests/mod.pp b/manifests/mod.pp index abe8105..7910008 100644 --- a/manifests/mod.pp +++ b/manifests/mod.pp @@ -39,7 +39,7 @@ $disable = false, $service_autorestart = '', $path = '/usr/bin:/bin:/usr/sbin:/sbin', - $package = $php::package + $package = $php::package, $version = '5', ) { @@ -49,11 +49,13 @@ $php_mod_enable = 'phpenmod' $php_mod_disable = 'phpdismod' $pkg_fpm = 'php7.0-fpm' + $phpquery = 'phpquery' } default: { $php_mod_enable = 'php5enmod' $php_mod_disable = 'php5dismod' $pkg_fpm = 'php5-fpm' + $phpquery = 'php5query' } } @@ -72,7 +74,7 @@ path => $path, notify => $real_service_autorestart, require => Package[$package], - onlyif => "php5query -M | grep -q '^${name}$'", + onlyif => "${phpquery} -M | grep -q '^${name}$'", } } else { exec { "php_mod_tool_enable_${name}": @@ -80,7 +82,7 @@ path => $path, notify => $real_service_autorestart, require => Package[$package], - unless => "php5query -M | grep -q '^${name}$'", + unless => "${phpquery} -M | grep -q '^${name}$'", } } diff --git a/manifests/params.pp b/manifests/params.pp index c4f544b..228a6d8 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -17,11 +17,11 @@ if ($::lsbdistrelease == '16.04') { $package_devel = 'php-dev' } else { - $package_devel = $::operatingsystem ? { - /(?i:Ubuntu|Debian|Mint)/ => 'php5-dev', - /(?i:SLES|OpenSuSe)/ => 'php5-devel', - default => 'php-devel', - } + $package_devel = $::operatingsystem ? { + /(?i:Ubuntu|Debian|Mint)/ => 'php5-dev', + /(?i:SLES|OpenSuSe)/ => 'php5-devel', + default => 'php-devel', + } } $package_pear = $::operatingsystem ? { /(?i:Ubuntu|Debian|Mint)/ => 'php-pear',