Chad has uploaded a new change for review. https://gerrit.wikimedia.org/r/301285
Change subject: WIP: Bring over php::ini from MediaWiki vagrant ...................................................................... WIP: Bring over php::ini from MediaWiki vagrant Way nicer method of managing PHP settings on a host WIP because I'm not sure on the notify bit yet... Change-Id: Ib23bb5051e58dacff8e882a10954585d7e921b72 --- A modules/php/manifests/ini.pp A modules/php/templates/conffile.ini.erb 2 files changed, 66 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/85/301285/1 diff --git a/modules/php/manifests/ini.pp b/modules/php/manifests/ini.pp new file mode 100644 index 0000000..b1e6391 --- /dev/null +++ b/modules/php/manifests/ini.pp @@ -0,0 +1,51 @@ +# == Define: php::ini +# +# This resource type represents a set of PHP configuration directives +# that are managed via an ini file in /etc/php5/conf.d. PHP interprets +# these files as extensions of the main php.ini configuration file. For +# more information, see <http://wiki.debian.org/PHP#Configuration_layout> +# and <http://php.net/manual/en/configuration.file.php>. +# +# === Parameters +# +# [*settings*] +# A hash or array of PHP configuration directives. For a list of core +# php.ini directives, see <http://www.php.net/manual/en/ini.php>. +# +# === Examples +# +# Example showing settings as a hash: +# +# php::ini { 'apc': +# settings => { +# 'apc.enabled' => 1, +# 'apc.cache_by_default' => 1 +# }, +# } +# +# Example showing settings as an array: +# +# php::ini { 'apc': +# settings => [ +# 'apc.enabled = 1', +# 'apc.cache_by_default = 1' +# ], +# } +# +define php::ini( $settings ) { + # Puppet-managed .ini file names start with an underscore + # so they can be distinguished from package-provided files. + $basename = inline_template('_<%= @title.gsub(/\W/, "-").downcase %>') + $conffile = "/etc/php5/mods-available/${basename}.ini" + + file { $conffile: + content => template('php/conffile.ini.erb'), + require => Package['php5'], + notify => Service['apache2'], + } + + exec { "/usr/sbin/php5enmod -s ALL ${basename}": + refreshonly => true, + subscribe => File[$conffile], + } +} diff --git a/modules/php/templates/conffile.ini.erb b/modules/php/templates/conffile.ini.erb new file mode 100644 index 0000000..7d7d7a6 --- /dev/null +++ b/modules/php/templates/conffile.ini.erb @@ -0,0 +1,15 @@ +; This file is managed by Puppet. + +<%= +case @settings +when Hash + @settings.sort.map { |k,v| + v = v ? 1 : 0 if [TrueClass, FalseClass].include? v.class + %Q(#{k} = "#{v}") + }.join("\n") +when Array + @settings.join("\n") +else + @settings +end +%> -- To view, visit https://gerrit.wikimedia.org/r/301285 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib23bb5051e58dacff8e882a10954585d7e921b72 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Chad <ch...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits