I want to delete all files and directories in a filesystem.
I have done a playbook with module find and file.
I get a list of files with the module find and then I delete the list with
module file and the option absent.
* - name: Gen list*
* find:*
* paths: "{{fs1}}"*
* recurse: yes*
* file_type: any*
* excludes: "lost+found"*
* register: files_to_delete*
* - name: Delete*
* file:*
* path: "{{ item.path }}"*
* state: absent*
* loop: "{{ files_to_delete.files }}"*
The playbook goes OK.
But now I want to use this playbook in a FileSystem with 15.000 files.
The task that list all files goes very fast, but task that delete file
generates a log to each item and the execution time is too big.
I execute the playbook and it doesn´t appear the files that I want to
remove. It looks that the remove has been executed, but the playbook it
appears generate logs and this is the cause of delay finish.
Is possible not generate the log for each item in the loop?
I don´t want to use shell module with rm -fr command..
Is there other option with ansible to remove all content of a Filesystem
with a lot of files and directories?
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/d3812461-0dbe-44ec-8637-b3bac8033ada%40googlegroups.com.