Defined Type: archive::download

Defined in:
manifests/download.pp

Summary

Archive downloader with integrity verification

Overview

Examples:

archive::download {"apache-tomcat-6.0.26.tar.gz":
  ensure => present,
  url    => "http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.26/bin/apache-tomcat-6.0.26.tar.gz",
}
archive::download {"apache-tomcat-6.0.26.tar.gz":
  ensure        => present,
  digest_string => "f9eafa9bfd620324d1270ae8f09a8c89",
  url           => "http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.26/bin/apache-tomcat-6.0.26.tar.gz",
}

Parameters:

  • url (String)

    source

  • headers (Array) (defaults to: [])

    HTTP (s) to pass to source

  • allow_insecure (Boolean) (defaults to: false)

    Allow self-signed certificate on source?

  • checksum (Boolean) (defaults to: true)

    Should checksum be validated?

  • digest_type (Enum['none', 'md5', 'sha1', 'sha2','sha256', 'sha384', 'sha512']) (defaults to: 'md5')

    Digest to use for calculating checksum

  • ensure (Enum['present', 'absent']) (defaults to: 'present')

    ensure file present/absent

  • src_target (Stdlib::Absolutepath) (defaults to: '/usr/src')

    Absolute path to staging location

  • digest_string (Optional[String]) (defaults to: undef)

    Value expected checksum

  • digest_url (Optional[String]) (defaults to: undef)

    URL expected checksum value

  • proxy_server (Optional[String]) (defaults to: undef)

    FQDN of proxy server

  • user (Optional[String]) (defaults to: undef)

    User used to download the archive



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'manifests/download.pp', line 39

define archive::download (
  String $url,
  Array $headers = [],
  Boolean $allow_insecure = false,
  Boolean $checksum = true,
  Enum['none', 'md5', 'sha1', 'sha2','sha256', 'sha384', 'sha512'] $digest_type = 'md5',   # bad default!
  Enum['present', 'absent'] $ensure = 'present',
  Stdlib::Absolutepath $src_target = '/usr/src',
  Optional[String] $digest_string = undef,
  Optional[String] $digest_url = undef,
  Optional[String] $proxy_server = undef,
  Optional[String] $user = undef,
) {
  $target = ($title =~ Stdlib::Absolutepath) ? {
    false   => "${src_target}/${title}",
    default => $title,
  }

  archive { $target:
    ensure          => $ensure,
    source          => $url,
    checksum_verify => $checksum,
    checksum        => $digest_string,
    checksum_type   => $digest_type,
    checksum_url    => $digest_url,
    proxy_server    => $proxy_server,
    user            => $user,
    headers         => $headers,
    allow_insecure  => $allow_insecure,
  }
}