when using  *domain_name|default("")|length > 0  *and the paramter is empry 
i'm geeting the follwoing error message.  When  the parameter include value 
it is working 

fatal: [10.164.237.140]: FAILED! => {"msg": "The conditional check 
'domain_name |  default(\"\") | length > 0' failed. The error was: 
Unexpected templating type error occurred on ({% if domain_name |  
default(\"\") | length > 0 %} True {% else %} False {% endif %}): object of 
type 'NoneType' has no len()\n\nThe error appears to be in 
'/data/ansible/new2_keycloak/create-realm-secert.yml': line 13, column 5, 
but may\nbe elsewhere in the file depending on the exact syntax 
problem.\n\nThe offending line appears to be:\n\n\n  - name: Copy realm no 
LDAP Support\n    ^ here\n"}

On Thursday, May 7, 2020 at 11:52:32 AM UTC+3, Vladimir Botka wrote:
>
> > when: domain_name | default("") == "" 
>
> Don't compare to empty string. Test the length instead 
>
> https://github.com/ansible/ansible-lint/blob/master/lib/ansiblelint/rules/ComparisonToEmptyStringRule.py
>  
>
>   when: domain_name|default("")|length > 0 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d60f8dee-4016-40be-8f1e-6fb1258038ea%40googlegroups.com.

Reply via email to