From 9afbe532300683ee994633706cc2e32873e1ef89 Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Sun, 10 Aug 2025 20:12:50 +0200 Subject: [PATCH] fix: adapt when condition --- tasks/main.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 6fec9d5..8ae2945 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,6 +1,6 @@ --- -- name: Include OS-specific variables +- name: "Include OS-specific variables" ansible.builtin.include_vars: "{{ ansible_os_family }}.yml" - name: "Remove existing systemd-networkd configuration" @@ -25,9 +25,9 @@ owner: "{{ systemd_networkd_unix_user }}" group: "{{ systemd_networkd_unix_user }}" mode: "0644" - when: item.netdev_options is defined and - item.netdev_options | selectattr("key", "==", "Kind") and - item.netdev_options | selectattr("value", "!=", "wireguard") + when: + item.netdev_options is defined and + (item.netdev_options | selectattr('key', 'equalto', 'Kind') | map(attribute='value') | first) != 'wireguard' with_items: "{{ systemd_networkd_netdev }}" - name: Create sensitive systemd.netdev files @@ -38,8 +38,7 @@ group: "{{ systemd_networkd_unix_user }}" mode: "0600" when: item.netdev_options is defined and - item.netdev_options | selectattr("key", "equalto", "Kind") and - item.netdev_options | selectattr("value", "equalto", "wireguard") + (item.netdev_options | selectattr('key', 'equalto', 'Kind') | map(attribute='value') | first) == 'wireguard' with_items: "{{ systemd_networkd_netdev }}" no_log: true notify: Restart networkd