# Getting : error while evaluating conditional (my\_result.stat.exists): 'bool object' has no attribute 'stat' while expcting to be dictionary

**URL:** <https://forum.ansible.com/t/getting-error-while-evaluating-conditional-my-result-stat-exists-bool-object-has-no-attribute-stat-while-expcting-to-be-dictionary/32850>\
**Category:** Ansible Project\
**Created:** [May 5, 2020, 10:26am UTC](https://forum.ansible.com/t/getting-error-while-evaluating-conditional-my-result-stat-exists-bool-object-has-no-attribute-stat-while-expcting-to-be-dictionary/32850 "2020-05-05T10:26:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Meir\_Yanovich](https://avatars.discourse-cdn.com/v4/letter/m/9de0a6/32.png) [@Meir\_Yanovich](https://forum.ansible.com/u/Meir_Yanovich)\
**Post date:** [May 5, 2020, 10:26am UTC](https://forum.ansible.com/t/getting-error-while-evaluating-conditional-my-result-stat-exists-bool-object-has-no-attribute-stat-while-expcting-to-be-dictionary/32850/1 "2020-05-05T10:26:00Z")

</div>

i have this ansible simple playbook :  
where “/home/ec2-user/test1.txt” exists on disk

`

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [May 5, 2020, 10:42am UTC](https://forum.ansible.com/t/getting-error-while-evaluating-conditional-my-result-stat-exists-bool-object-has-no-attribute-stat-while-expcting-to-be-dictionary/32850/2 "2020-05-05T10:42:07Z")

</div>

> i have this ansible simple playbook :  
> where "/home/ec2-user/test1.txt" exists on disk
> 
> \>  
> ---  
> -name:check ifexsist  
> hosts:localhost  
> gather\_facts:false  
> tasks:
> 
> ```
> \-name:Getproject name
> shell:&quot;echo &#39;hhhhhhhh&#39;&quot;
> register:name\_var
> 
> \-name:Checkifthetest\.log exists inpath
> stat:
> path:&quot;/home/ec2\-user/test1\.txt1&quot;
> register:log\_result\_1
> 
> \-name:CheckifTheTest\.log exists inp\_home
> stat:
> path:&quot;/home/ec2\-user/test1\.txt&quot;
> register:log\_result\_2
> when:name\_var\.stdout ismatch\(&quot;hhhhhhhh&quot;\)
> 
> \-set\_fact:
> my\_result:&quot;\{\{ log\_result\_1\.stat\.exists or \(log\_result\_2 is not skipped and log\_result\_2\.stat\.exists\) \}\}&quot;
> 
> \-debug:
> msg:&quot;\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\# result\_value \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#&quot;
> \-debug:
> var:my\_result
> 
> \-name:Createtemporary log folder
> file:
> path:&quot;/home/ec2\-user/log\_tmp&quot;
> state:directory
> when:my\_result\.stat\.exists
> 
> ```
> 
> \>
> 
> I expect that the my\_result will have the value of the right register in this case log\_result\_2

No the output is a boolean, variables are evaluated in your expression.

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke
