Andrew Pollock
unread,Oct 6, 2010, 2:31:07 PM10/6/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to augeas...@redhat.com, puppet...@googlegroups.com, Bryan Kearney, Free Ekanayaka
Hi,
Sorry for the broad distribution, I'm not sure who best can help me.
I'm trying to add a new interface stanza to /etc/network/interfaces.
With augtool, I can accomplish this with the following:
set /files/etc/network/interfaces/iface[last()+1] bond1
set /files/etc/network/interfaces/iface[last()]/family inet
set /files/etc/network/interfaces/iface[last()]/method dhcp
set /files/etc/network/interfaces/iface[last()]/slaves eth2
I've been able to translate that to the following Puppet resource:
augeas { "bond1":
context => "/files/etc/network/interfaces",
changes => [
"set iface[last()+1] bond1",
"set iface[last()]/family inet",
"set iface[last()]/method dhcp",
"set iface[last()]/slaves eth2",
],
}
All good so far, except this will unconditionally create the interface stanza every time Puppet runs. That's fine, this is what the "onlyif" directive is for, right? I just can't make it work.
I'm a bit hazy on how "match" works. From augtool, I can go
match /files/etc/network/interfaces/iface[*]
and sort of get back a list of interface names. I was thinking that maybe I could do something with that, but I'm not entirely sure what.
I hear there's some user-contributed Augeas examples in a Puppet wiki somewhere, but I haven't been able to find them. Any pointers appreciated.
regards
Andrew