Skip to content

Commit

Permalink
Use default value when expr. evaluates to false
Browse files Browse the repository at this point in the history
According to http://jinja.pocoo.org/docs/2.10/templates/#default

>  If you want to use default with variables that evaluate to false you
> have to set the second parameter to true

This is the only way to use the default value when passing None, since
it evaluates to false.
  • Loading branch information
sauloperez committed Nov 22, 2018
1 parent 3eb9b64 commit 6a16c08
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

- name: Check if certificate already exists
stat:
path: "/etc/letsencrypt/live/{{ certbot_nginx_cert_name | default(domain_name) }}/cert.pem"
path: "/etc/letsencrypt/live/{{ certbot_nginx_cert_name | default(domain_name, true) }}/cert.pem"
register: letsencrypt_cert

- name: Generate new certificate if one doesn't exist
Expand Down

0 comments on commit 6a16c08

Please sign in to comment.