]> gitweb.fluxo.info Git - puppet-websites.git/commitdiff
Adds websites::resources
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 29 Oct 2015 14:50:11 +0000 (12:50 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 29 Oct 2015 14:50:11 +0000 (12:50 -0200)
manifests/init.pp
manifests/resources.pp [new file with mode: 0644]

index ec6c0cfbd2ded7173f3b48e8ab885416dcd86cb9..1ff58690e86d7386048e7120554b14afcdf20821 100644 (file)
@@ -4,31 +4,4 @@ class websites inherits websites::setup {
     mpm     => false,
     tag     => 'all',
   }
-
-  # Retrieve configured instances
-  $sites     = hiera('apache::sites',           {})
-  $databases = hiera('database::instances',     {})
-  $ikiwikis  = hiera('ikiwiki::instances',      {})
-  $domains   = hiera('domain_check::instances', {})
-
-  # Apply instances
-  create_resources('apache::site',           $sites)
-  create_resources('database::instance',     $databases)
-  create_resources('ikiwiki::instance',      $ikiwikis)
-  create_resources('domain_check::instance', $domains)
-
-  # Remove untagged site instances
-  Apache::Site <| tag != $::hostname and tag != 'all' |> {
-    ensure => absent,
-  }
-
-  # Remove untagged database instances
-  Database::Instance <| tag != $::hostname and tag != 'all' |> {
-    ensure => absent,
-  }
-
-  # Remove untagged ikiwiki instances
-  Ikiwiki::Instance <| tag != $::hostname and tag != 'all' |> {
-    ensure => absent,
-  }
 }
diff --git a/manifests/resources.pp b/manifests/resources.pp
new file mode 100644 (file)
index 0000000..5b4a19d
--- /dev/null
@@ -0,0 +1,28 @@
+class websites::resources {
+  # Retrieve configured instances
+  $sites     = hiera('apache::sites',           {})
+  $databases = hiera('database::instances',     {})
+  $ikiwikis  = hiera('ikiwiki::instances',      {})
+  $domains   = hiera('domain_check::instances', {})
+
+  # Apply instances
+  create_resources('apache::site',           $sites)
+  create_resources('database::instance',     $databases)
+  create_resources('ikiwiki::instance',      $ikiwikis)
+  create_resources('domain_check::instance', $domains)
+
+  # Remove untagged site instances
+  Apache::Site <| tag != $::hostname and tag != 'all' |> {
+    ensure => absent,
+  }
+
+  # Remove untagged database instances
+  Database::Instance <| tag != $::hostname and tag != 'all' |> {
+    ensure => absent,
+  }
+
+  # Remove untagged ikiwiki instances
+  Ikiwiki::Instance <| tag != $::hostname and tag != 'all' |> {
+    ensure => absent,
+  }
+}