# Ansible find module not accepting fatal: \[127.0.0.1\]: FAILED! =\> {"changed": false, "msg": "Unsupported parameters for (find) module: become Supported parameters include: age, age\_stamp, contains, depth, excludes, file\_type, follow, get\_checksum, hid

**URL:** <https://forum.ansible.com/t/ansible-find-module-not-accepting-fatal-127-0-0-1-failed-changed-false-msg-unsupported-parameters-for-find-module-become-supported-parameters-include-age-age-stamp-contains-depth-excludes-file-type-follow-get-checksum-hid/31692>\
**Category:** Ansible Project\
**Created:** [November 20, 2019, 1:25pm UTC](https://forum.ansible.com/t/ansible-find-module-not-accepting-fatal-127-0-0-1-failed-changed-false-msg-unsupported-parameters-for-find-module-become-supported-parameters-include-age-age-stamp-contains-depth-excludes-file-type-follow-get-checksum-hid/31692 "2019-11-20T13:25:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nasir\_Nasir](https://avatars.discourse-cdn.com/v4/letter/n/3e96dc/32.png) [@Nasir\_Nasir](https://forum.ansible.com/u/Nasir_Nasir)\
**Post date:** [November 20, 2019, 1:25pm UTC](https://forum.ansible.com/t/ansible-find-module-not-accepting-fatal-127-0-0-1-failed-changed-false-msg-unsupported-parameters-for-find-module-become-supported-parameters-include-age-age-stamp-contains-depth-excludes-file-type-follow-get-checksum-hid/31692/1 "2019-11-20T13:25:02Z")

</div>

I want to access a directory as sudo user of Linux when i gave

Below is the code for the same which i tried;

- name: Ansible delete files older than 1 minutes example  
find:  
paths: ‘{{diskclrpath}}’  
age: ‘{{fileage}}’  
patterns: ‘{{file\_ext}}’

# size: ‘{{file\_size}}’

recurse: yes  
become: true

# become\_method: su

register: files\_to\_delete

- debug:  
msg: “files in the path are: ‘{{files\_to\_delete}}’”

- name: Ansible remove files older than a date example  
file:  
path: “{{ item.path }}”  
state: absent  
become: yes  
with\_items: “{{ files\_to\_delete.files }}”  
loop\_control:  
label: “{{ item.path }}”  
when: ((diskspc\_util \>= ‘{{diskuseper}}’) and ( ‘rwx’ not in permissionchk))

getting below Error for it.

fatal: [127.0.0.1]: FAILED! =\> {“changed”: false, “msg”: “Unsupported parameters for (find) module: become Supported parameters include: age, age\_stamp, contains, depth, excludes, file\_type, follow, get\_checksum, hidden, paths, patterns, recurse, size, use\_regex”}

Please help me on this.

---

<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:** [November 20, 2019, 1:29pm UTC](https://forum.ansible.com/t/ansible-find-module-not-accepting-fatal-127-0-0-1-failed-changed-false-msg-unsupported-parameters-for-find-module-become-supported-parameters-include-age-age-stamp-contains-depth-excludes-file-type-follow-get-checksum-hid/31692/2 "2019-11-20T13:29:05Z")

</div>

> I want to access a directory as sudo user of Linux when i gave
> 
> Below is the code for the same which i tried;
> 
> ```
> \- name: Ansible delete files older than 1 minutes example
> find:
> paths: &#39;\{\{diskclrpath\}\}&#39;
> age: &#39;\{\{fileage\}\}&#39;
> patterns: &#39;\{\{file\_ext\}\}&#39;
> 
> ```
> 
> # size: '{{file\_size}}'  
> recurse: yes  
> become: true  
> # become\_method: su  
> register: files\_to\_delete  
> - debug:  
> msg: "files in the path are: '{{files\_to\_delete}}'"
> 
> ```
> \- name: Ansible remove files older than a date example
> file:
> path: &quot;\{\{ item\.path \}\}&quot;
> state: absent
> become: yes
> with\_items: &quot;\{\{ files\_to\_delete\.files \}\}&quot;
> loop\_control:
> label: &quot;\{\{ item\.path \}\}&quot;
> when: \(\(diskspc\_util &gt;= &#39;\{\{diskuseper\}\}&#39;\) and \( &#39;rwx&#39; not in permissionchk\)\)
> 
> ```
> 
> getting below Error for it.
> 
> fatal: [127.0.0.1]: FAILED! =\> {"changed": false, "msg": "Unsupported parameters for (find) module: become Supported  
> parameters include: age, age\_stamp, contains, depth, excludes, file\_type, follow, get\_checksum, hidden, paths, patterns,  
> recurse, size, use\_regex"}
> 
> Please help me on this.

Well, the error message gives the clue away. "become" is as task parameter and not a parameter of the find module.  
So you need to fix the indentation.

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

---

<div class="post-metadata">

**Author:** ![acozine1](https://avatars.discourse-cdn.com/v4/letter/a/c89c15/32.png) [@acozine1](https://forum.ansible.com/u/acozine1)\
**Post date:** [November 20, 2019, 3:32pm UTC](https://forum.ansible.com/t/ansible-find-module-not-accepting-fatal-127-0-0-1-failed-changed-false-msg-unsupported-parameters-for-find-module-become-supported-parameters-include-age-age-stamp-contains-depth-excludes-file-type-follow-get-checksum-hid/31692/3 "2019-11-20T15:32:56Z")

</div>

Become is a task keyword. In your playbook you are using it as if it were a parameter of the “find” module. Move it up under the “name” line and indent it to the same level as the module name:

> - name: Ansible delete files older than 1 minutes example

become: true  
become\_method: su

> find:  
> paths: ‘{{diskclrpath}}’  
> age: ‘{{fileage}}’  
> patterns: ‘{{file\_ext}}’
> 
> # size: ‘{{file\_size}}’
> 
> recurse: yes  
> register: files\_to\_delete
> 
> - debug:  
> msg: “files in the path are: ‘{{files\_to\_delete}}’”

See [https://docs.ansible.com/ansible/latest/user\_guide/become.html](https://docs.ansible.com/ansible/latest/user_guide/become.html) for more details.
