Miha Frangež 2026-01-09 11:34:36 +01:00
parent 32ddf5e58e
commit 0ae9d05921
2 changed files with 8 additions and 1 deletions

View file

@ -6,6 +6,7 @@ class FilterModule(object):
return {
'defaultattr': self.defaultattr,
'list2dict': self.list2dict,
'any': self.any,
}
def defaultattr(self, objects, attr, val=None):
@ -19,3 +20,9 @@ class FilterModule(object):
Like items2dict but keep entire dictionaries as values.
'''
return {item[key]: item for item in items}
def any(self, items):
'''
Return True if any item in the list is True.
'''
return any(items)

View file

@ -92,7 +92,7 @@
when: not is_proxmox # proxmox has its own firewall configuration
- name: Run SSH instance in management VRF
when: interfaces | selectattr('vrf') | selectattr('vrf.name', '==', 'mgmt')
when: interfaces | selectattr('vrf') | selectattr('vrf.name', '==', 'mgmt') | any
block:
- name: Configure SSH instance in management VRF
copy: