Skip to content

Instantly share code, notes, and snippets.

Last active Aug 29, 2015
What would you like to do?
Finding the first active ethernet interface with ansible
def first_eth(v, **kw):
'''Finding the first active ethernet interface'''
for n in range(10):
name = 'ansible_eth%i' % n
if name not in v:
eth = v[name]
if eth['active']:
return eth
class FilterModule(object):
def filters(self):
return dict(first_eth=first_eth)
Copy link

athoune commented Oct 8, 2014

You need a setting in your ansible.cfg :

filter_plugins = ./filter_plugins

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment