Puppet and best way to append a new user to sshd_config AllowUsers with augeas

258 views
Skip to first unread message

Remi Ferrand

unread,
Feb 19, 2014, 7:44:28 AM2/19/14
to puppet...@googlegroups.com
Hi,

I'm just starting to play with puppet and augeas and I've managed to add a new user to the AllowUsers list of *sshd_config*.

I'm doing it this way:

$user='testuser'

augeas {'test':
    context     => '/files/etc/ssh/sshd_config',
    changes     => [
        "defnode 001 etc/ssh/sshd_config/AllowUsers/001 $user",
    ],
    onlyif      => "match etc/ssh/sshd_config/AllowUsers/*[.='${user}'] size == 0"
}

Because this is one of my first real use case of puppet and augeas, I'm just wondering what's the best way to achieve the same goal and add a user to AllowUsers.
How would you, folks, do that ? Am I using the right augeas directives ?

Thanks for your replies.

Cheers

Rémi Ferrand
Reply all
Reply to author
Forward
Message has been deleted
0 new messages