/[adm]/puppet/modules/concat/manifests/fragment.pp
ViewVC logotype

Contents of /puppet/modules/concat/manifests/fragment.pp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 241 - (show annotations) (download)
Fri Nov 12 17:42:22 2010 UTC (13 years, 5 months ago) by boklm
File size: 2157 byte(s)
Add a module to construct files from fragments.

Downloaded from https://github.com/ripienaar/puppet-concat/


1 # Puts a file fragment into a directory previous setup using concat
2 #
3 # OPTIONS:
4 # - target The file that these fragments belong to
5 # - content If present puts the content into the file
6 # - source If content was not specified, use the source
7 # - order By default all files gets a 10_ prefix in the directory
8 # you can set it to anything else using this to influence the
9 # order of the content in the file
10 # - ensure Present/Absent or destination to a file to include another file
11 # - mode Mode for the file
12 # - owner Owner of the file
13 # - group Owner of the file
14 # - backup Controls the filebucketing behavior of the final file and
15 # see File type reference for its use. Defaults to 'puppet'
16 define concat::fragment($target, $content='', $source='', $order=10, $ensure = "present", $mode = 0644, $owner = root, $group = root, $backup = "puppet") {
17 $safe_name = regsubst($name, '/', '_', 'G')
18 $safe_target_name = regsubst($target, '/', '_', 'G')
19 $concatdir = $concat::setup::concatdir
20 $fragdir = "${concatdir}/${safe_target_name}"
21
22 # if content is passed, use that, else if source is passed use that
23 # if neither passed, but $ensure is in symlink form, make a symlink
24 case $content {
25 "": {
26 case $source {
27 "": {
28 case $ensure {
29 "", "absent", "present", "file", "directory": {
30 crit("No content, source or symlink specified")
31 }
32 }
33 }
34 default: { File{ source => $source } }
35 }
36 }
37 default: { File{ content => $content } }
38 }
39
40 file{"${fragdir}/fragments/${order}_${safe_name}":
41 mode => $mode,
42 owner => $owner,
43 group => $group,
44 ensure => $ensure,
45 backup => $backup,
46 alias => "concat_fragment_${name}",
47 notify => Exec["concat_${target}"]
48 }
49 }
50
51 # vi:tabstop=4:expandtab:ai

  ViewVC Help
Powered by ViewVC 1.1.30