Defined Type: php::mod
- Defined in:
- manifests/mod.pp
Overview
Define: php::mod
This define configures php mods-available to all SAPI using php5en,dismod
Parameters
- disable
-
Set to ‘true’ to disable the php mod-availables to all SAPI using php5dismod Default: false, i.e, Set the php mod-availables to all SAPI using php5enmod.
- service_autorestart
-
whatever we want a module installation notify a service to restart.
Usage
- name
-
is filename without .ini extension from /etc/php5/mods-available/<name>.ini
php::mod { “<name>”: }
Example
This will configure php5-mcrypt module to all SAPI
php::mod { “mcrypt”: }
$mods = [“mcrypt”, “mongo”] php::mod { “$mods”: }
This will unconfigure php5-xdebug module to all SAPI
php::mod { “xdebug”:
disable => true,
}
Note that you may include or declare the php class when using the php::module define
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'manifests/mod.pp', line 38
define php::mod (
$disable = false,
$service_autorestart = '',
$path = '/usr/bin:/bin:/usr/sbin:/sbin',
$package = $php::package
) {
include php
$real_service_autorestart = $service_autorestart ? {
true => "Service[${php::service}]",
false => undef,
'' => $php::service_autorestart ? {
true => "Service[${php::service}]",
false => undef,
}
}
if $disable {
exec { "php_mod_tool_disable_${name}":
command => "php5dismod ${name}",
path => $path,
notify => $real_service_autorestart,
require => Package[$package],
onlyif => "php5query -M | grep -q '^${name}$'",
}
} else {
exec { "php_mod_tool_enable_${name}":
command => "php5enmod ${name}",
path => $path,
notify => $real_service_autorestart,
require => Package[$package],
unless => "php5query -M | grep -q '^${name}$'",
}
}
}
|