summaryrefslogtreecommitdiff
path: root/manifests/site.pp
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/site.pp')
-rw-r--r--manifests/site.pp48
1 files changed, 48 insertions, 0 deletions
diff --git a/manifests/site.pp b/manifests/site.pp
new file mode 100644
index 0000000..1886f9b
--- /dev/null
+++ b/manifests/site.pp
@@ -0,0 +1,48 @@
+define nginx::site($ensure = present, $source = 'file') {
+ case $source {
+ 'file': {
+ file { "/etc/nginx/sites-available/$name":
+ source => "puppet:///modules/site_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":
+ content => template("nginx/$name.erb"),
+ owner => "root",
+ group => "root",
+ mode => 0644,
+ ensure => $ensure,
+ notify => Service["nginx"],
+ require => File["/etc/nginx/sites-available"],
+ }
+ }
+ 'none': {
+ file { "/etc/nginx/sites-available/$name":
+ owner => "root",
+ group => "root",
+ mode => 0644,
+ ensure => $ensure,
+ notify => Service["nginx"],
+ require => File["/etc/nginx/sites-available"],
+ }
+ }
+ }
+
+ $link = $ensure ? {
+ present => "/etc/nginx/sites-available/$name",
+ default => absent,
+ }
+
+ # Symlink to enable proxy configuration
+ file { "/etc/nginx/sites-enabled/$name":
+ ensure => $link,
+ require => File["/etc/nginx/sites-enabled"],
+ notify => Service["nginx"],
+ }
+}