Idk if i did understand correctly, but there is the replace parameter in
the file resource that may help here.

Regards
El 24/04/2014 15:33, "Paul Tötterman" <paul.totter...@gmail.com> escribió:

> Hi,
>
> I'm managing workstations using puppet, and I was wondering if there's a
> better way to do this:
>
> $dir = inline_template('<%=ENV["HOME"]%>')
>
> define customizable_file($source=undef,$template=undef,$replacemd5='') {
>>     $tmplname = $template ? {
>>         undef   => "$name.common",
>>         default => "$template",
>>     }
>>     file { "$tmplname":
>>         source => $source,
>>     }
>>     exec { "cp $tmplname $name":
>>         onlyif  => "test ! -e $name -o \"$(md5sum $name|cut -d' ' -f1)\"
>> = \"$replacemd5\"",
>>         path    => ['/bin', '/usr/bin'],
>>         require => File["$tmplname"],
>>     }
>> }
>> customizable_file { "$dir/foo-$::hostname":
>>     source     => 'file:///etc/motd',
>>     template   => "$dir/foo-common",
>>     replacemd5 => 'e43e23c6d9a376bedd1ae405be4fdf97',
>> }
>
>
> What I want to achieve is a file that is managed by puppet, but if the
> user touches it, puppet stops touching the file. Normal file resource with
> replace doesn't cut it in this case. replacemd5 should be set to the md5
> sum of the previous version of the file. I'd really like to see a custom
> type for this, that would handle templating some nice way, or at least
> allow one to specify more that one md5sum of previous versions. Obviously
> this doesn't work well for files that change often.
>
> So, is there a better way?
>
> Cheers,
> Paul
>
> PS. $dir is set to home so that you can dump the contents to a file and
> puppet apply it to test.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/a5a6e496-5853-4a47-a7fb-14ab5f6c1f4e%40googlegroups.com<https://groups.google.com/d/msgid/puppet-users/a5a6e496-5853-4a47-a7fb-14ab5f6c1f4e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAF_B3deEZu7%2B59Yzu%2BUPEVaHwWjEnLdn6GPGtz0k4gWoqA_Oag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to