There are at least three ways to do this: 1) Use an Augeas resource to edit the file. For system files this can be a good solution since Augeas generally has lenses for them. 2) Use an Exec resource and something like sed or cat. Not my preferred approach but sometimes the easiest, especially if you already scripted the task in bash at some point. The tricky bit is getting the 'unless' portion working right so it doesn't run every time and just keep adding lines. 3) The 'concat' third-party module allows building a file from arbitrary chunks of text, which can include a both server-side and client-side pieces. I just started using this one but so far it's very cool. Even if you don't end up using it this time around it's worth a look in case you need it later. https://github.com/ripienaar/puppet-concat
On Thu, Jun 23, 2011 at 3:55 AM, Sans <[email protected]> wrote: > Dear all, > > As in the title, how do I add some extra lines in a existing file and > check every time for its presence? I just don't want to copy over the > existing file for some good reason (system files etc.). > > Any idea how should I do that? cheers!! > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
