Index: modules/nginx/manifests/init.pp |
=================================================================== |
--- a/modules/nginx/manifests/init.pp |
+++ b/modules/nginx/manifests/init.pp |
@@ -1,7 +1,8 @@ |
class nginx ( |
$worker_processes = $nginx::params::worker_processes, |
$worker_connections = $nginx::params::worker_connections, |
- $ssl_session_cache = $nginx::params::ssl_session_cache |
+ $ssl_session_cache = $nginx::params::ssl_session_cache, |
+ $fragment_directory = "/etc/nginx/fragments", |
) inherits nginx::params { |
apt::source {'nginx': |
@@ -44,6 +45,23 @@ |
require => Package['nginx'] |
} |
+ file {$fragment_directory: |
+ ensure => directory, |
+ require => Package['nginx'], |
+ } |
+ |
+ define hostconfig-fragment ( |
+ $domain, |
+ $content = undef, |
+ $ensure = 'present') { |
+ |
+ file {"${$nginx::fragment_directory}/${domain}/${name}.conf": |
+ content => $content, |
+ ensure => $ensure, |
+ require => File["${nginx::fragment_directory}/${domain}"], |
+ } |
+ } |
+ |
define hostconfig ( |
$domain = $title, |
$alt_names = [], |
@@ -55,6 +73,12 @@ |
$certificate = undef, |
$private_key = undef, |
$enabled = true) { |
+ |
+ file {"${nginx::fragment_directory}/${domain}": |
+ ensure => directory, |
+ require => File[$nginx::fragment_directory], |
+ } |
+ |
file {"/etc/nginx/sites-available/${domain}": |
ensure => file, |
content => template('nginx/site.erb'), |