Defined Type: php::module
- Defined in:
- manifests/module.pp
Overview
Define: php::module
This define installs and configures php modules On Debian and derivatives it install module named php5-$name On RedHat and derivatives it install module named php-$name If you need a custom prefix you can overload default $module_prefix parameter
Parameters
- version
-
Version to install.
- absent
-
true to ensure package isn’t installed.
- notify_service
-
If you want to restart a service automatically when the module is applied. Default: true
- service_autorestart
-
whatever we want a module installation notify a service to restart.
- service
-
Service to restart.
- module_prefix
-
If package name prefix isn’t standard.
- install_options
-
An array of package manager install options. See $php::install_options
Examples
php::module { ‘gd’: }
php::module { ‘gd’:
ensure => absent,
}
This will install php-apc on debian instead of php5-apc
php::module { ‘apc’:
module_prefix => "php-",
}
Note that you may include or declare the php class when using the php::module define
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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'manifests/module.pp', line 48
define php::module (
$version = 'present',
$install_options = [],
$service_autorestart = '',
$module_prefix = '',
$absent = '',
$package = $php::package
) {
include php
if $absent != '' and $absent != false {
$real_version = 'absent'
} else {
$real_version = $version
}
$real_service_autorestart = $service_autorestart ? {
true => "Service[${php::service}]",
false => undef,
'' => $php::service_autorestart ? {
true => "Service[${php::service}]",
false => undef,
}
}
$real_module_prefix = $module_prefix ? {
'' => $php::module_prefix,
default => $module_prefix,
}
$real_install_options = $install_options ? {
'' => $php::install_options,
default => $install_options,
}
$real_install_package = "${real_module_prefix}${name}"
if defined(Package[$real_install_package]) == false {
package { "PhpModule_${name}":
ensure => $real_version,
name => $real_install_package,
notify => $real_service_autorestart,
install_options => $real_install_options,
require => Package[$package],
}
}
}
|