# backward incompatible change in module find in ansible 2.3

**URL:** <https://forum.ansible.com/t/backward-incompatible-change-in-module-find-in-ansible-2-3/24910>\
**Category:** Ansible Project\
**Created:** [July 6, 2017, 11:33am UTC](https://forum.ansible.com/t/backward-incompatible-change-in-module-find-in-ansible-2-3/24910 "2017-07-06T11:33:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Renaud\_Michel](https://avatars.discourse-cdn.com/v4/letter/r/7bcc69/32.png) [@Renaud\_Michel](https://forum.ansible.com/u/Renaud_Michel)\
**Post date:** [July 6, 2017, 11:33am UTC](https://forum.ansible.com/t/backward-incompatible-change-in-module-find-in-ansible-2-3/24910/1 "2017-07-06T11:33:49Z")

</div>

Hello

Thought I should mention this somewhere, there has been an incompatible  
change in the find module in ansible 2.3, which is not mentioned in the  
changelog (or I didn't understand it).

Until ansible 2.2, the file\_type option accepted two values, 'file' and  
'directory'.  
Due to the use of the os.stat method, symbolic links pointing to a file  
would be included for file\_type=='file' and those pointing to directories  
for file\_type=='directory'.

Now in ansible 2.3, two new values for file\_type have been added, 'link'  
and 'any'.  
Now the module uses the os.lstat method which does not follow symbolic  
links (otherwise it would not be possible to distinguish them).

So if you used the find module with ansible 2.2 (or older) with the  
file\_type=='file' to list symbolic links in a directory it will not work  
anymore with ansible 2.3.

For my own use case, I have done the following to be compatible with both  
ansible 2.2 and 2.3:

&nbsp;&nbsp;&nbsp;&nbsp;file\_type: '{{"link" if ansible\_version.full|version\_compare("2.3.0","\>=") else "file"}}'

I actually wanted only the symbolic links, to compare the to a list of  
wanted links and remove the others, but if you want the old behaviour of  
file\_type=='file' you need to filter the result of any and it will be  
harder to be compatible with both 2.2 and 2.3.

I suppose it is too late to report this as a bug, as ansible 2.3 has been  
released for some time already, changing it to be compatible with previous  
versions would break it for people who stated using it with ansible 2.3.

---

<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:** [July 6, 2017, 6:27pm UTC](https://forum.ansible.com/t/backward-incompatible-change-in-module-find-in-ansible-2-3/24910/2 "2017-07-06T18:27:00Z")

</div>

> I suppose it is too late to report this as a bug, as ansible 2.3 has been  
> released for some time already, changing it to be compatible with previous  
> versions would break it for people who stated using it with ansible 2.3.

It seams that the find module become stable in 2.3 so i guess this is OK.

The fist commit stableinterface appeared  
&nbsp;&nbsp;&nbsp;$ git log -S stableinterface --source find.py  
&nbsp;&nbsp;&nbsp;commit 73191045527834fbabc40cf47a2173d5933ae480 HEAD  
&nbsp;&nbsp;&nbsp;Author: Toshio Kuratomi \<a.badger@gmail.com\>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Refreshed metadata for core modules

Tags containing that commit  
&nbsp;&nbsp;&nbsp;$ git tag --contains 73191045527834fbabc40cf47a2173d5933ae480  
&nbsp;&nbsp;&nbsp;v2.3.0.0-0.1.rc1  
&nbsp;&nbsp;&nbsp;v2.3.0.0-0.2.rc2  
&nbsp;&nbsp;&nbsp;v2.3.0.0-0.3.rc3  
&nbsp;&nbsp;&nbsp;v2.3.0.0-0.4.rc4  
&nbsp;&nbsp;&nbsp;v2.3.0.0-0.5.rc5  
&nbsp;&nbsp;&nbsp;v2.3.0.0-0.6.rc6  
&nbsp;&nbsp;&nbsp;v2.3.0.0-1  
&nbsp;&nbsp;&nbsp;v2.3.1.0-0.1.rc1  
&nbsp;&nbsp;&nbsp;v2.3.1.0-0.2.rc2  
&nbsp;&nbsp;&nbsp;v2.3.1.0-1  
&nbsp;&nbsp;&nbsp;v2.3.2.0-0.1.rc1

---

<div class="post-metadata">

**Author:** ![Renaud\_Michel](https://avatars.discourse-cdn.com/v4/letter/r/7bcc69/32.png) [@Renaud\_Michel](https://forum.ansible.com/u/Renaud_Michel)\
**Post date:** [July 7, 2017, 10:43am UTC](https://forum.ansible.com/t/backward-incompatible-change-in-module-find-in-ansible-2-3/24910/3 "2017-07-07T10:43:44Z")

</div>

Oh, sorry I missed that.  
So that's why it wasn't mentioned in the changelog.
