[augeas-devel] Help matching a PAM config line
Tim Bishop
tim-lists at bishnet.net
Wed Oct 23 21:39:12 UTC 2013
Hi,
I'd like to ask for some Augeas help. I'm trying to match a specific PAM
config line so I can append something to it. The relevant lines are:
session optional pam_motd.so motd=/run/motd.dynamic noupdate
session optional pam_motd.so # [1]
What I want to do is add "noupdate" to second line.
I've done something similar previously using Puppet with this block:
augeas { "disableupdates-$name":
context => "/files/etc/pam.d/$name",
changes => [
"ins argument after *[module = 'pam_motd.so']/module",
"set *[module = 'pam_motd.so']/argument 'noupdate'",
],
onlyif => "match *[module = 'pam_motd.so' and argument='noupdate'] size == 0",
notify => Exec['pam-auth-update'],
}
But at the time the PAM config only contained this line:
session optional pam_motd.so # [1]
This no longer works because my onlyif statement matches on the new line
before it.
So I'd like some help to modify the above code to only match and modify
the second line. Or maybe there's another way that I've not thought of?
Thank you in advance,
Tim.
--
Tim Bishop
http://www.bishnet.net/tim/
PGP Key: 0x6C226B37FDF38D55
More information about the augeas-devel
mailing list