Entonces en mi código tengo una tarea
- name: cool task
  shell: 'touch iamnotcool.txt'
  when: me.cool is not defined
y mi vars parece
---
me:
  stumped: yes
Entonces, cuando ejecuto la tarea, vuelve con el siguiente error
{"failed": true, "msg": "The conditional check 'me.cool' failed. The error was: error while evaluating conditional (me.cool): 'dict object' has no attribute 'cool'.
                
                    
                        ansible
                                ansible-playbook
                                conditional
                                
                    
                    
                        Luis F Hernández
fuente
                
                
            fuente

when: is_installed.rc is defined and is_installed.rc == 0Esto no:when: is_installed.rc is defined\nwhen is_installed.rc == 0Puede evitar que 'dict object' no tenga atributo utilizando la sintaxis jinja2 selectattr () como en:
idea obtenida de Michael Hoglan en https://groups.google.com/forum/#!topic/ansible-project/8XJkHQgttLA
fuente