]> git.donarmstrong.com Git - dsa-puppet.git/blobdiff - 3rdparty/modules/staging/manifests/deploy.pp
add nanliu/staging to 3rdparty
[dsa-puppet.git] / 3rdparty / modules / staging / manifests / deploy.pp
diff --git a/3rdparty/modules/staging/manifests/deploy.pp b/3rdparty/modules/staging/manifests/deploy.pp
new file mode 100644 (file)
index 0000000..5650387
--- /dev/null
@@ -0,0 +1,42 @@
+# The define resource extracts compressed file to a staging location.
+define staging::deploy (
+  $source,               #: the source file location, supports local files, puppet://, http://, https://, ftp://
+  $target,               #: the target extraction directory
+  $staging_path = undef, #: the staging location for compressed file. defaults to ${staging::path}/${caller_module_name}
+  $username     = undef, #: https or ftp username
+  $certificate  = undef, #: https certifcate file
+  $password     = undef, #: https or ftp user password or https certificate password
+  $environment  = undef, #: environment variable for settings such as http_proxy
+  $timeout      = undef, #: the time to wait for the file transfer to complete
+  $user         = undef, #: extract file as this user
+  $group        = undef, #: extract group as this group
+  $creates      = undef, #: the file/folder created after extraction. if unspecified defaults to ${target}/${name}
+  $unless       = undef, #: alternative way to conditionally extract file
+  $onlyif       = undef  #: alternative way to conditionally extract file
+) {
+
+  staging::file { $name:
+    source      => $source,
+    target      => $staging_path,
+    username    => $username,
+    certificate => $certificate,
+    password    => $password,
+    environment => $environment,
+    subdir      => $caller_module_name,
+    timeout     => $timeout,
+  }
+
+  staging::extract { $name:
+    target      => $target,
+    source      => $staging_path,
+    user        => $user,
+    group       => $group,
+    environment => $environment,
+    subdir      => $caller_module_name,
+    creates     => $creates,
+    unless      => $unless,
+    onlyif      => $onlyif,
+    require     => Staging::File[$name],
+  }
+
+}