exit: support custom VRF imports

Ten minutes to set up and ten hours to convince Ansible to not be
quite so retarded. The list2dict filter seems to be the (or another)
missing piece. Now let’s rewrite everything else using it. Or not.
This commit is contained in:
Timotej Lazar 2024-07-15 11:28:33 +02:00
parent 99aef43574
commit 82b10e8133
4 changed files with 60 additions and 7 deletions

14
filter_plugins/util.py Normal file
View file

@ -0,0 +1,14 @@
#!/usr/bin/python
class FilterModule(object):
'''Helper filters to make Ansible less unpleasant'''
def filters(self):
return {
'list2dict': self.list2dict,
}
def list2dict(self, items, key):
'''
Like items2dict but keep entire dictionaries as values.
'''
return {item[key]: item for item in items}