Re: [Puppet Users] Adding Lines to *Existing* Files?

Patrick
Tue, 02 Nov 2010 05:55:36 -0000

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:ALL


For this, use Augeas, puppet-concat, or templates.