# Ansible stat - check file exists not working

**URL:** <https://forum.ansible.com/t/ansible-stat-check-file-exists-not-working/24628>\
**Category:** Ansible Project\
**Created:** [June 2, 2017, 1:33am UTC](https://forum.ansible.com/t/ansible-stat-check-file-exists-not-working/24628 "2017-06-02T01:33:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anfield](https://avatars.discourse-cdn.com/v4/letter/a/dec6dc/32.png) [@Anfield](https://forum.ansible.com/u/Anfield)\
**Post date:** [June 2, 2017, 1:33am UTC](https://forum.ansible.com/t/ansible-stat-check-file-exists-not-working/24628/1 "2017-06-02T01:33:27Z")

</div>



---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [June 2, 2017, 4:55am UTC](https://forum.ansible.com/t/ansible-stat-check-file-exists-not-working/24628/2 "2017-06-02T04:55:19Z")

</div>

The var= in debug is for variables, for text you need to use msg=

So to print out the content of your file.  
- debug: var=file

To print text:  
- debug: msg="file exist and content of exists {{ file.stat.exists }}"

Since file is a module name, you shouldn't use that as you variable name.
