Hi *! Here is a hack to emulate cfengines editfiles/Group behaviour. {{{ $splice_dir = "/var/local/puppet/splice" file { $splice_dir: ensure => directory, tag => "file_splice", } # Replace a section marked by # comment_char {BEGIN,END} pattern # with the given content # if checksum is set to "none", no resource is defined for the edited file define file_splice ($file, $pattern = "PUPPET SECTION", $comment_char = "#", $content = "", $input_file = "", $checksum = md5) { case $checksum { "none": {} default: { file { $file: checksum => $checksum } } } # the splice command needs at least the BEGIN line in the file append_if_no_such_line { "seed-$file-$pattern": file => $file, line => "$comment_char BEGIN $pattern", require => File [ $file ], } case $content { "": { case $input_file { "": { fail ("either input_file or content have to be supplied") } default: { exec{ "/usr/local/bin/file_splice ''$input_file'' ''$comment_char'' ''$pattern'' $file": require => Append_if_no_such_line [ "seed-$file-$pattern" ], subscribe => [ File[$input_file], File[$file] ], } } } } default: { $splice_file = "$splice_dir/$name" file { $splice_file: mode => 0600, owner => root, group => root, content => $content, require => File [ $splice_dir ], } exec{ "/usr/local/bin/file_splice ''$splice_file'' ''$comment_char'' ''$pattern'' $file": require => Append_if_no_such_line [ "seed-$file-$pattern" ], subscribe => [ File [ $splice_file ], File[$file] ] } } } } }}} Usage example: manual conf.d style includes {{{ # monitor this file for updates $munin_includes = "$splice_dir/munin_conf_includes" file { $munin_includes: checksum => md5, } # this directory collects munin-node definitions from the munin-nodes $NODESDIR = "/var/local/puppet/munin-nodes" # concatenate all definitions into one file exec { create_munin_includes: command => "/bin/sh -c ''/bin/cat $NODESDIR/* > $munin_includes''", subscribe => File[$NODESDIR] } # include the file in the main config file_splice { munin_conf_includes: file => "/etc/munin/munin.conf", input_file => "$splice_dir/munin_conf_includes", require => Exec[create_munin_includes], subscribe => File[$munin_includes], } }}} Feedback, alternatives and improvements very welcome! Perhaps one day I''ll even make a better integrated version without a perl(!) script but a real ruby type which recognizes when it should or should not run. Regards, David -- - hallo... wie gehts heute? - *hust* gut *rotz* *keuch* - gott sei dank kommunizieren wir über ein septisches medium ;) -- Matthias Leeb, Uni f. angewandte Kunst, 2005-02-15 _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users