Skip to content

Commit

Permalink
Merge pull request #269 from pcfens/apache_config
Browse files Browse the repository at this point in the history
Manage apache/PHP configurations
  • Loading branch information
jyaworski committed Nov 10, 2016
2 parents bc912d1 + 435443d commit a87005f
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
29 changes: 29 additions & 0 deletions manifests/apache_config.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Install and configure php apache settings
#
# === Parameters
#
# [*inifile*]
# The path to the ini php-apache ini file
#
# [*settings*]
# Hash with nested hash of key => value to set in inifile
#
class php::apache_config(
$inifile = $::php::params::apache_inifile,
$settings = {}
) inherits ::php::params {

if $caller_module_name != $module_name {
warning('php::apache_config is private')
}

validate_absolute_path($inifile)
validate_hash($settings)

$real_settings = deep_merge($settings, hiera_hash('php::apache::settings', {}))

::php::config { 'apache':
file => $inifile,
config => $real_settings,
}
}
12 changes: 12 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
# [*phpunit*]
# Install phpunit
#
# [*apache_config*]
# Manage apache's mod_php configuration
#
# [*environment*]
# Environment variables for settings such as http_proxy, https_proxy, or ftp_proxy.
# These are passed through to the underlying exec(s), so it follows the same format
Expand Down Expand Up @@ -119,6 +122,7 @@
$pear = true,
$pear_ensure = $::php::params::pear_ensure,
$phpunit = false,
$apache_config = false,
$environment = undef,
$manage_curl = true,
$extensions = {},
Expand All @@ -142,6 +146,7 @@
validate_bool($ext_tool_enabled)
validate_string($pear_ensure)
validate_bool($phpunit)
validate_bool($apache_config)
validate_bool($manage_curl)
validate_hash($extensions)
validate_hash($settings)
Expand Down Expand Up @@ -233,6 +238,13 @@
class { '::php::phpunit': } ->
Anchor['php::end']
}
if $apache_config {
Anchor['php::begin'] ->
class { '::php::apache_config':
settings => $real_settings,
} ->
Anchor['php::end']
}

create_resources('::php::extension', $real_extensions, {
require => Class['::php::cli'],
Expand Down
2 changes: 2 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
$fpm_service_name = $php::globals::fpm_service_name
$fpm_user = 'www-data'
$fpm_group = 'www-data'
$apache_inifile = "${config_root}/apache2/php.ini"
$embedded_package_suffix = 'embed'
$embedded_inifile = "${config_root}/embed/php.ini"
$package_prefix = $php::globals::package_prefix
Expand Down Expand Up @@ -115,6 +116,7 @@
$fpm_service_name = 'php-fpm'
$fpm_user = 'apache'
$fpm_group = 'apache'
$apache_inifile = '/etc/php.ini'
$embedded_package_suffix = 'embedded'
$embedded_inifile = '/etc/php.ini'
$package_prefix = 'php-'
Expand Down

0 comments on commit a87005f

Please sign in to comment.