What, if any, is the best way to programatically add lines to an existing file with puppet? What I''m going for precisely is adding lines to either /etc/passwd and /etc/shadow (on Solaris) or /etc/ security/access.conf (on Linux) at "run" time. Adding lines to wind up with files along these lines, +@MyGroupToLetIn:x::::: /etc/passwd . . +@myldapgroup:x::::: -:x::::: /etc/shadow . . +@myldapgroup:x:12345::::: /etc/security/access.conf . . +:@myldapgroup:ALL I guess I could use a template, but unless I want to try to keep on top of what those files contain in dozens of client machines that seems pretty painful. Maybe the concat module? -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Michael Semcheski
2010-Nov-01 22:37 UTC
Re: [Puppet Users] Adding Lines to *Existing* Files?
On Mon, Nov 1, 2010 at 6:29 PM, nickt <ntkach@gmail.com> wrote:> What, if any, is the best way to programatically add lines to an > existing file with puppet? What I''m going for precisely is adding > lines to either /etc/passwd and /etc/shadow (on Solaris) or /etc/ > security/access.conf (on Linux) at "run" time. Adding lines to wind > up with files along these lines, +@MyGroupToLetIn:x:::::This is exactly what augeas is for. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Nov 1, 2010, at 3:29 PM, nickt wrote:> What, if any, is the best way to programatically add lines to an > existing file with puppet? What I''m going for precisely is adding > lines to either /etc/passwd and /etc/shadow (on Solaris) or /etc/ > security/access.conf (on Linux) at "run" time. Adding lines to wind > up with files along these lines, +@MyGroupToLetIn:x::::: > > /etc/passwd > . > . > +@myldapgroup:x::::: > -:x::::: > > /etc/shadow > . > . > +@myldapgroup:x:12345:::::Use the User resource to add the user and set information about it.> /etc/security/access.conf > . > . > +:@myldapgroup:ALLFor this, use Augeas, puppet-concat, or templates. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.