saltstack/salt — Issue #614: Add interface info to grains
Author: archtaku
Created: 2012-01-31 00:45:32+00:00
State: open

A while back I added several functions to the network module, which parse the ip command and return information about the different interfaces. There is a command called network.interfaces which returns the info in a dict like so:

{'myhost': {'eth0': {'hwaddr': 'ff:ff:ff:ff:ff:ff',
'ipaddr': '192.168.24.32',
'netmask': '255.255.255.128',
'up': True},
'lo': {'hwaddr': '00:00:00:00:00:00',
'ipaddr': '127.0.0.1',
'netmask': '255.0.0.0',
'up': True}}}

It would be useful to get this data into the core grains. Ruby's facter will create separate "facts" for each interface and each piece of data about those interfaces. Talking with SEJeff in IRC, we both agreed that this is ugly and we should come up with a better way, so I'm opening this issue for discussion.

Once we decide on something, I'm happy to write the code. It should be quite simple since the function which does all the legwork of retrieving the information already exists.