aboutsummaryrefslogtreecommitdiff
path: root/manifests/file.pp
blob: b3985c709d688c53c142076ee93673b2555d2b7b (plain)
1
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
# Define: tftp::file
#
# Parameters:
#
# Actions:
#
# Requires:
#
# Usage:
#
define tftp::file (
  $ensure       = file,
  $owner        = 'tftp',
  $group        = 'tftp',
  $mode         = '0644',
  $recurse      = false,
  $purge        = undef,
  $replace      = undef,
  $recurselimit = undef,
  $content      = undef,
  $source       = undef
) {
  include 'tftp'

  if $source {
    $source_real = $source
  } elsif $ensure != 'directory' and ! $content {
    if $caller_module_name {
      $mod = $caller_module_name
    } else {
      $mod = $module_name
    }
    $source_real = "puppet:///modules/${mod}/${name}"
  }

  file { "${tftp::directory}/${name}":
    ensure       => $ensure,
    owner        => $owner,
    group        => $group,
    mode         => $mode,
    recurse      => $recurse,
    purge        => $purge,
    replace      => $replace,
    recurselimit => $recurselimit,
    content      => $content,
    source       => $source_real,
    require      => Class['tftp'],
  }
}