Hi guys,
I was enlightened by the 'puppet+augeas modprobe.conf' post (thanks!)
and was going to put inittab under puppet/augeas management.
My goal is to add this one line for spawning a console on the serial
port if it doesn't exist:
co:12345:respawn:/sbin/agetty ttyS0 19200 vt100
However the task proved to be more tricky than I first imaged. There
were two thing I was stuck on. Firstly inittab tree in augeas starts
with number instead of arrays, and I had to work around to append with
ins and last(). Secondly the match in onlyif didn't seem to like
spaces, so I was unsure how I can match the sequence exactly.
I came up with the following:
augeas { "inittab":
context => "/files/etc/inittab",
changes => [ "set 100/id 'co'",
"set 100/runlevels 12345",
"set 100/action respawn",
"set 100/process \"/sbin/agetty ttyS0 19200 vt100\"",
],
onlyif => "match */id[.='co'] size == 0'",
#onlyif => "match */process[.='/sbin/agetty ttyS0 19200 vt100']
size == 0",
}
So for my first problem, I used an arbitary large number (100) so it's
outside the existing line ranges - not robust and could inadvertently
overwrite something else. But for the matching, the first onlyif
works but the commented out one would error with
err: //Augeas[inittab]: Failed to retrieve current state of resource:
Error sending command 'match' with params ["vt100']", "size", "==",
"0"]/unknown error - Matching path expression '/files/etc/inittab/*/
process[.='/sbin/agetty' failed
I would really want to match on the serial console port (ttyS0) in
case it's named under a different id on an existing host. Did a
search and found a previous issue at
http://projects.reductivelabs.com/issues/1835
that looked similar, but the set I've used which contains spaces
worked beautifully so this should be something else.
Any ideas how I can achieve the append?
Thanks very much.
Hui
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---