diff --git a/tasks/config.yml b/tasks/config.yml
index aae0e946d118519dfbb038f88bc8d3f2760f3620..871b4d204942851bcd9b0afb95d48ba3c2138dc9 100644
--- a/tasks/config.yml
+++ b/tasks/config.yml
@@ -101,7 +101,7 @@
             common_name: "{{ inventory_hostname }}"
 
       when:
-        - ( "md" not in apache_mods_enabled ) or ( apache_cert is defined and not apache_cert.stat.exists )
+        - ( "md" not in apache_mods_enabled ) or ( apache_cert.stat is defined and not apache_cert.stat.exists )
         - ( "ssl" in apache_mods_enabled )
         - ( "le" in apache_conf_enabled )
         - ( common_name is defined ) and ( common_name == inventory_hostname )