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

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to