diff options
author | Branan Purvine-Riley <branan@puppetlabs.com> | 2012-06-25 14:35:29 -0700 |
---|---|---|
committer | Branan Purvine-Riley <branan@puppetlabs.com> | 2012-06-25 14:35:29 -0700 |
commit | a2263208cd6e5007b28ef3859f2699b4b9580e25 (patch) | |
tree | 3ae144a5eaba9b35376c81d802a918f16c2b689f /manifests/file.pp | |
parent | 6500ac722b939b86c32559508be3c7f224ba5cfe (diff) | |
parent | 600754c8d841646c73df3e0fe5d4290e8ddfd37d (diff) | |
download | puppet-tftp-a2263208cd6e5007b28ef3859f2699b4b9580e25.tar.gz puppet-tftp-a2263208cd6e5007b28ef3859f2699b4b9580e25.tar.bz2 |
Merge pull request #8 from nanliu/tb/defaults
Add default module path for tftp::file
Diffstat (limited to 'manifests/file.pp')
-rw-r--r-- | manifests/file.pp | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/manifests/file.pp b/manifests/file.pp index ec67f2c..3628188 100644 --- a/manifests/file.pp +++ b/manifests/file.pp @@ -2,18 +2,37 @@ # # Parameters: # +# [*ensure*]: file type, default file. +# [*owner*]: file owner, default tftp. +# [*group*]: file group. default tftp. +# [*mode*]: file mode, default 0644 (puppet will change to 0755 for directories). +# [*content*]: file content. +# [*source*]: file source, defaults to puppet*]:///module/${caller_module_name}/${name} for files without content. +# [*recurse*]: directory recurse, default false. +# [*purge*]: directory recurse and purge. +# [*replace*]: replace directory with file or symlink, default undef, +# [*recurselimit*]: directory recurse limit, default undef, +# # Actions: # -# Requires: +# Deploy files into the tftp directory. # # Usage: # +# tftp::file { 'pxelinux.0': +# source => 'puppet:///modules/acme/pxelinux.0', +# } +# +# tftp::file { 'pxelinux.cfg': +# ensure => directory, +# } +# define tftp::file ( $ensure = file, - $recurse = false, $owner = 'tftp', $group = 'tftp', $mode = '0644', + $recurse = false, $purge = undef, $replace = undef, $recurselimit = undef, @@ -22,17 +41,28 @@ define tftp::file ( ) { 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, - recurse => $recurse, owner => $owner, group => $group, mode => $mode, + recurse => $recurse, purge => $purge, replace => $replace, recurselimit => $recurselimit, content => $content, - source => $source, + source => $source_real, require => Class['tftp'], } } |