1. Éric Veiras Galisson
  2. puppet-modules

Commits

Éric Veiras Galisson  committed 3e7719f

nginx: changing how nginx service is restarted when a file change

  • Participants
  • Parent commits ce8b445
  • Branches default

Comments (0)

Files changed (5)

File nginx/README

View file
 
             you can also specify another source directly
 
+        enabled (optional, default: true):
+            enable this vhost?
+

File nginx/manifests/site/proxy.pp

View file
         content => template("nginx/proxy.erb")
     }
 
-    $ensure = $enabled ? {
-        true    => "link",
-        default => "absent",
-    }
-
     file { "${dst_filename}":
-        ensure => "${ensure}",
-        target => "${src_filename}",
+        ensure          => $enabled ? {
+            true        => link,
+            default     => absent,
+        },
+        target          => "${src_filename}",
+        subscribe       => File["${src_filename}"],
+        notify          => Class['nginx::service'],
     }
 }

File nginx/manifests/site/raw.pp

View file
             ],
             default => "${source}",
         },
-        notify  => Class['nginx::service'],
-        require => Class['nginx::package'],
     }
 
     file { "${dst_filename}":
-        ensure    => $enabled ? {
-            true    => link,
-            default => absent,
+        ensure          => $enabled ? {
+            true        => link,
+            default     => absent,
         },
-        target    => "${src_filename}",
-        subscribe => File["${src_filename}"],
-        notify  => Class['nginx::service'],
-        require => Class['nginx::package'],
+        target          => "${src_filename}",
+        subscribe       => File["${src_filename}"],
+        notify          => Class['nginx::service'],
     }
 }

File nginx/manifests/site/redirect.pp

View file
         content => template("nginx/redirect.erb")
     }
 
-    $ensure = $enabled ? {
-        true     => "link",
-        default  => "absent",
-    }
-
     file { "${dst_filename}":
-        ensure => "${ensure}",
-        target => "${src_filename}",
+        ensure          => $enabled ? {
+            true        => link,
+            default     => absent,
+        },
+        target          => "${src_filename}",
+        subscribe       => File["${src_filename}"],
+        notify          => Class['nginx::service'],
     }
 }

File nginx/manifests/site/static.pp

View file
         content => template("nginx/static.erb")
     }
 
-    $ensure = $enabled ? {
-        true     => "link",
-        default  => "absent",
-    }
-
     file { "${dst_filename}":
-        ensure => "${ensure}",
-        target => "${src_filename}",
+        ensure          => $enabled ? {
+            true        => link,
+            default     => absent,
+        },
+        target          => "${src_filename}",
+        subscribe       => File["${src_filename}"],
+        notify          => Class['nginx::service'],
     }
 }