summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2010-02-17 19:53:54 -0200
committerSilvio Rhatto <rhatto@riseup.net>2010-02-17 19:53:54 -0200
commitbb81a0b6bfd9fe42d99bcf90e83e7c888c31bac3 (patch)
treef7eb22628b383e82424eac3a7ae1b52c8076d309 /manifests
parent7bee5405e1c2fb76d14779e1c9c5c3a43a7a239c (diff)
downloadpuppet-nginx-bb81a0b6bfd9fe42d99bcf90e83e7c888c31bac3.tar.gz
puppet-nginx-bb81a0b6bfd9fe42d99bcf90e83e7c888c31bac3.tar.bz2
Cleanup
Diffstat (limited to 'manifests')
-rw-r--r--manifests/init.pp54
1 files changed, 29 insertions, 25 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index 7d28fa1..894cb5e 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -41,25 +41,40 @@ class nginx::base {
require => Package["nginx"],
}
- define site($site = $domain, $ensure = present) {
+ define site($ensure = present, $source = 'file') {
# Proxy config file
- file { "/etc/nginx/sites-available/$site":
- source => "puppet://$server/files/etc/nginx/$site",
- owner => "root",
- group => "root",
- mode => 0644,
- ensure => $ensure,
- notify => Service["nginx"],
- require => File["/etc/nginx/sites-available"],
+ case $source {
+ 'file': {
+ file { "/etc/nginx/sites-available/$name":
+ source => "puppet://$server/files/etc/nginx/$name",
+ owner => "root",
+ group => "root",
+ mode => 0644,
+ ensure => $ensure,
+ notify => Service["nginx"],
+ require => File["/etc/nginx/sites-available"],
+ }
+ }
+ 'template': {
+ file { "/etc/nginx/sites-available/$name":
+ source => content("nginx/$name.erb"),
+ owner => "root",
+ group => "root",
+ mode => 0644,
+ ensure => $ensure,
+ notify => Service["nginx"],
+ require => File["/etc/nginx/sites-available"],
+ }
+ }
}
$link = $ensure ? {
- present => "/etc/nginx/sites-available/$site",
+ present => "/etc/nginx/sites-available/$name",
default => absent,
}
# Symlink to enable proxy configuration
- file { "/etc/nginx/sites-enabled/$site":
+ file { "/etc/nginx/sites-enabled/$name":
ensure => $link,
require => File["/etc/nginx/sites-enabled"],
notify => Service["nginx"],
@@ -124,21 +139,10 @@ class nginx::puppetmaster inherits nginx::base {
notify => Service["nginx"],
}
- file { "/etc/nginx/sites-available/$name":
- content => template("nginx/puppetmaster.erb"),
- owner => "root",
- group => "root",
- mode => 0644,
+ site { "puppetmaster":
ensure => present,
- notify => Service["nginx"],
- require => File["/etc/nginx/sites-available"],
- }
-
- # Symlink to enable proxy configuration
- file { "/etc/nginx/sites-enabled/$name":
- ensure => "/etc/nginx/sites-available/$name",
- require => File["/etc/nginx/sites-enabled"],
- notify => Service["nginx"],
+ source => 'template',
+ require => File['/etc/nginx/conf.d/puppetmaster.conf'],
}
}
}