Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: modules/nginx/manifests/init.pp

Issue 5731052198821888: #1203 - Establish nginx::hostconfig-fragment() directive (Closed)
Patch Set: #1203 - Establish nginx::hostconfig-fragment() directive Created Aug. 13, 2014, 9:49 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | modules/nginx/templates/site.erb » ('j') | modules/trac/manifests/init.pp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,24 @@
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}"],
+ notify => Service['nginx'],
+ }
+ }
+
define hostconfig (
$domain = $title,
$alt_names = [],
@@ -55,6 +74,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'),
« no previous file with comments | « no previous file | modules/nginx/templates/site.erb » ('j') | modules/trac/manifests/init.pp » ('J')

Powered by Google App Engine
This is Rietveld