From b4861fe689d2086919359305c3618f27942c0156 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 23 Jul 2015 12:40:12 +0200 Subject: [PATCH] Puppet: Set date.timezone for PHP in a separate INI file --- .puppet/modules/php/manifests/init.pp | 17 ++------------- .puppet/modules/php/manifests/phpd.pp | 21 +++++++++++++++++++ .../modules/php/templates/timezone.ini.erb | 1 + 3 files changed, 24 insertions(+), 15 deletions(-) create mode 100644 .puppet/modules/php/manifests/phpd.pp create mode 100644 .puppet/modules/php/templates/timezone.ini.erb diff --git a/.puppet/modules/php/manifests/init.pp b/.puppet/modules/php/manifests/init.pp index dd6df83b3..788ad5df1 100644 --- a/.puppet/modules/php/manifests/init.pp +++ b/.puppet/modules/php/manifests/init.pp @@ -20,24 +20,11 @@ class php { package { 'php': ensure => latest, - require => Package['apache'], - notify => Service['apache'] - } - # TODO(el): Always executed. Should be a resource - -> exec { 'php-timezone': - command => 'sed -re $\'s#^;?(date\\.timezone =).*$#\\1 "UTC"#\' -i /etc/php.ini', notify => Service['apache'], + require => Package['apache'], } - file { '/etc/php.d/error_reporting.ini': - content => template('php/error_reporting.ini.erb'), + php::phpd { ['error_reporting', 'timezone', 'xdebug_settings' ]: require => Package['php'], - notify => Service['apache'] - } - - file { '/etc/php.d/xdebug_settings.ini': - content => template('php/xdebug_settings.ini.erb'), - require => Package['php'], - notify => Service['apache'] } } diff --git a/.puppet/modules/php/manifests/phpd.pp b/.puppet/modules/php/manifests/phpd.pp new file mode 100644 index 000000000..4d59223cb --- /dev/null +++ b/.puppet/modules/php/manifests/phpd.pp @@ -0,0 +1,21 @@ +# define: php::phpd +# +# Provision php.d config +# +# Parameters: +# +# Actions: +# +# Requires: +# +# Sample Usage: +# +define php::phpd { + + include php + + file { "/etc/php.d/$name.ini": + content => template("php/$name.ini.erb"), + notify => Service['apache'], + } +} diff --git a/.puppet/modules/php/templates/timezone.ini.erb b/.puppet/modules/php/templates/timezone.ini.erb new file mode 100644 index 000000000..51e82763b --- /dev/null +++ b/.puppet/modules/php/templates/timezone.ini.erb @@ -0,0 +1 @@ +date.timezone = "UTC"