From 836d554e7b19cc7ab3d2c9edae975926b8ea4f12 Mon Sep 17 00:00:00 2001 From: jack Date: Sun, 22 Mar 2026 17:46:30 +0700 Subject: [PATCH] fix: handle None from lookup('file') when postfix-accounts.cf doesn't exist lookup(..., errors='ignore') returns None (not empty string) for missing files. Use | default('', true) to also convert falsy None to empty string. Co-Authored-By: Claude Sonnet 4.6 --- roles/tools/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/tools/tasks/main.yml b/roles/tools/tasks/main.yml index ec3c4a1..cf3f24d 100644 --- a/roles/tools/tasks/main.yml +++ b/roles/tools/tasks/main.yml @@ -145,7 +145,7 @@ - { address: "jack@{{ domain_base }}", password: "{{ mailserver_jack_password }}" } when: > not postfix_accounts_file.stat.exists or - item.address not in (lookup('file', tools_root + '/mailserver/config/postfix-accounts.cf', errors='ignore') | default('')) + item.address not in (lookup('file', tools_root + '/mailserver/config/postfix-accounts.cf', errors='ignore') | default('', true)) # ── DKIM ───────────────────────────────────────────────────────────────────── - name: Check if DKIM key exists