summaryrefslogtreecommitdiff
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
parent7bee5405e1c2fb76d14779e1c9c5c3a43a7a239c (diff)
downloadpuppet-nginx-bb81a0b6bfd9fe42d99bcf90e83e7c888c31bac3.tar.gz
puppet-nginx-bb81a0b6bfd9fe42d99bcf90e83e7c888c31bac3.tar.bz2
Cleanup
-rw-r--r--manifests/init.pp54
-rw-r--r--templates/puppetmaster.conf.erb4
2 files changed, 31 insertions, 27 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'],
}
}
}
diff --git a/templates/puppetmaster.conf.erb b/templates/puppetmaster.conf.erb
index e74c39d..9671bb3 100644
--- a/templates/puppetmaster.conf.erb
+++ b/templates/puppetmaster.conf.erb
@@ -4,8 +4,8 @@
# service in Puppet.
ssl on;
-ssl_certificate /var/lib/puppet/ssl/certs/puppetmaster.example.com.pem;
-ssl_certificate_key /var/lib/puppet/ssl/private_keys/puppetmaster.example.com.pem;
+ssl_certificate /var/lib/puppet/ssl/certs/puppet.<%= domain %>.pem;
+ssl_certificate_key /var/lib/puppet/ssl/private_keys/puppet.<%= domain %>.pem;
ssl_client_certificate /var/lib/puppet/ssl/certs/ca.pem;
ssl_ciphers SSLv2:-LOW:-EXPORT:RC4+RSA;
ssl_session_cache shared:SSL:8m;