From 5b21d439e952292a46cf9e659bf8ea6c50de2030 Mon Sep 17 00:00:00 2001
From: Silvio Rhatto <rhatto@riseup.net>
Date: Tue, 5 Jul 2016 15:52:58 -0300
Subject: Adds php::resources

---
 manifests/config.pp    | 1 +
 manifests/init.pp      | 4 +++-
 manifests/resources.pp | 6 ++++++
 3 files changed, 10 insertions(+), 1 deletion(-)
 create mode 100644 manifests/resources.pp

diff --git a/manifests/config.pp b/manifests/config.pp
index 22ae8a8..83910d4 100644
--- a/manifests/config.pp
+++ b/manifests/config.pp
@@ -5,6 +5,7 @@ define php::config($key, $value, $ensure = 'present', $sapi = '') {
     group   => root,
     mode    => 0644,
     content => "${key}=${value}\n",
+    require => File["${::php::folder}/${sapi}"],
     notify  => $sapi ? {
       'apache2' => Service['apache2'],
       default   => undef,
diff --git a/manifests/init.pp b/manifests/init.pp
index 034801f..b413992 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -62,6 +62,8 @@ class php {
                  "puppet:///modules/php/apache2/php.${::operatingsystem}.ini",
                  "puppet:///modules/php/apache2/php.ini" ],
     notify  => Service['apache2'],
-    require => [ Package['php5'], File["${folder}/etc/php5/apache2'] ],
+    require => [ Package['php5'], File["${folder}/etc/php5/apache2"] ],
   }
+
+  include php::resources
 }
diff --git a/manifests/resources.pp b/manifests/resources.pp
new file mode 100644
index 0000000..88e173c
--- /dev/null
+++ b/manifests/resources.pp
@@ -0,0 +1,6 @@
+class php::resources {
+  $configs = hiera('php::config', {})
+
+  # Apply instances
+  create_resources('php::config', $configs)
+}
-- 
cgit v1.2.3