From 0ae9d0592187ed26bf0a101253be824cb514970d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miha=20Frange=C5=BE?= Date: Fri, 9 Jan 2026 11:34:36 +0100 Subject: [PATCH] New ansible is more strict about types See https://docs.ansible.com/projects/ansible/latest/porting_guides/porting_guide_core_2.19.html#broken-conditionals --- filter_plugins/util.py | 7 +++++++ roles/debian/tasks/main.yml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/filter_plugins/util.py b/filter_plugins/util.py index af5d1b7..e0b34e3 100644 --- a/filter_plugins/util.py +++ b/filter_plugins/util.py @@ -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) diff --git a/roles/debian/tasks/main.yml b/roles/debian/tasks/main.yml index 66b0761..b0606d1 100644 --- a/roles/debian/tasks/main.yml +++ b/roles/debian/tasks/main.yml @@ -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: