Defined Type: staging::deploy

Defined in:
manifests/deploy.pp

Overview

The define resource extracts compressed file to a staging location.

Parameters:

  • target (Any)
  • source (Any) (defaults to: undef)
  • staging_path (Any) (defaults to: undef)
  • username (Any) (defaults to: undef)
  • certificate (Any) (defaults to: undef)
  • password (Any) (defaults to: undef)
  • environment (Any) (defaults to: undef)
  • strip (Any) (defaults to: undef)
  • unzip_opts (Any) (defaults to: '')
  • timeout (Any) (defaults to: undef)
  • user (Any) (defaults to: undef)
  • group (Any) (defaults to: undef)
  • creates (Any) (defaults to: undef)
  • unless (Any) (defaults to: undef)
  • onlyif (Any) (defaults to: undef)


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'manifests/deploy.pp', line 2

define staging::deploy (
  $target,               #: the target extraction directory
  $source       = undef, #: the source file location, supports local files, puppet:///, http://, https://, ftp://
  $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
  $strip        = undef, #: extract file with the --strip=X option. Only works with GNU tar.
  $unzip_opts   = '',    #: additional options to pass the unzip command.
  $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
) {

  # grab file name if path was passed in
  if $name =~ /.*\/(.*)/ {
    $file_name = $1
  } else {
    $file_name = $name
  }

  if $source {
    $source_path = $source
  } else {
    $source_path = $name
  }

  staging::file { $file_name:
    source      => $source_path,
    target      => $staging_path,
    username    => $username,
    certificate => $certificate,
    password    => $password,
    environment => $environment,
    subdir      => $caller_module_name,
    timeout     => $timeout,
  }

  staging::extract { $file_name:
    target      => $target,
    source      => $staging_path,
    user        => $user,
    group       => $group,
    environment => $environment,
    strip       => $strip,
    unzip_opts  => $unzip_opts,
    subdir      => $caller_module_name,
    creates     => $creates,
    unless      => $unless,
    onlyif      => $onlyif,
    require     => Staging::File[$file_name],
  }

}