how to use defualts and two user in augeas sudo

asked 2015-03-14 14:38:34 -0500

Chutki gravatar image


Generally I use templates to maintain sudoers, but I tried to implement in augeas just to understand augeas better and also it worked for few user. But I faced issues with defaults and passing two user

Defaults    always_set_home
Defaults    requiretty
use01,user02 ALL = NOPASSWD: /sbin/service

when I print in augtool and get


/files/etc/sudoers/spec[17]/user[1] = "user01"
/files/etc/sudoers/spec[17]/user[2] = "user02"

But when I try to convert into puppet with augeas resource getting error could not do that

changes => "set Defaults/requirettty/ ' '"
changes => "set Defaults/visiblepw/negate ' '"

$var = ["user01","user02"]

changes => "set spec[user=$var]/user $var",
                 "set spec[user = $var]/host_group/host ALL",
                "set spec[user = $var]/host_group/tag NOPASSWD",

For Defaults, either not getting error or not printing any value in /etc/sudoers file.

For two user, it is taking as [user='user01user02'] a single user with error. But I want this as [user='user01,'user02'] two separate user.

is it possible in augeas.

edit retag flag offensive close merge delete