# The find module doesn't seem to work with certain file types (block devices)

**URL:** <https://forum.ansible.com/t/the-find-module-doesnt-seem-to-work-with-certain-file-types-block-devices/20526>\
**Category:** Ansible Project\
**Created:** [February 10, 2016, 11:08pm UTC](https://forum.ansible.com/t/the-find-module-doesnt-seem-to-work-with-certain-file-types-block-devices/20526 "2016-02-10T23:08:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [February 10, 2016, 11:08pm UTC](https://forum.ansible.com/t/the-find-module-doesnt-seem-to-work-with-certain-file-types-block-devices/20526/1 "2016-02-10T23:08:01Z")

</div>

Just curious if this is a bug in the find module or if it’s working as intended?

Running ansible 2.0.0.2

Demo snippet:

`

- name: module find mpath  
find: paths=‘/dev/mapper’ patterns=‘mpath_p_’  
register: modfind\_result

- debug: var=modfind\_result

- name: shell find mpath  
shell: find /dev/mapper -name mpath_p_  
register: shfind\_result

- debug: var=shfind\_result

`

Output:

`

TASK [module find mpath] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [devwebdb0]

TASK [debug] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [devwebdb0] =\> {  
“modfind\_result”: {  
“changed”: false,  
“examined”: 3,  
“files”: ,  
“matched”: 0,  
“msg”: “”  
}  
}

TASK [shell find mpath] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
changed: [devwebdb0]

TASK [debug] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [devwebdb0] =\> {  
“shfind\_result”: {  
“changed”: true,  
“cmd”: “find /dev/mapper -name mpath_p_”,  
“delta”: “0:00:00.404326”,  
“end”: “2016-02-10 14:51:21.624126”,  
“rc”: 0,  
“start”: “2016-02-10 14:51:21.219800”,  
“stderr”: “”,  
“stdout”: “/dev/mapper/mpath5p1”,  
“stdout\_lines”: [  
“/dev/mapper/mpath5p1”  
],  
“warnings”:   
}  
}

`

modfind\_result.examined=3, so it appears to be seeing the device files, however modfind\_result.files=, which would make me think it’s not matching the pattern. Using patterns=“\*” or leaving it out entirely returns the same results however, and it works just fine if I try and match against a text or binary file.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [February 11, 2016, 3:28am UTC](https://forum.ansible.com/t/the-find-module-doesnt-seem-to-work-with-certain-file-types-block-devices/20526/2 "2016-02-11T03:28:43Z")

</div>

find uses stat.S\_ISREG to check if it is a regular file, so devices, sockets, pipes will all be ignored, we might want to add an option to control the file types.
