Use the find module to list the files you want /register the files and then
loop the car to remove the file in file module
On Tue, 29 Dec 2020 at 4:06 PM Reneesh K <[email protected]> wrote:

> I used the file module, but it is deleting even the logs directory. This
> is my code.
>
> - name: empty logs directory
>   file:
>     path: /app/logs/
>     state: absent
>
> Best Regards,
> Reneesh K
>
>
> On Mon, Dec 28, 2020 at 9:02 PM Wei-Yen Tan <[email protected]> wrote:
>
>> Even better. Use file module
>>
>> On Tue, 29 Dec 2020 at 4:01 PM Tej Singh Rana <[email protected]>
>> wrote:
>>
>>> use command or shell module
>>>
>>>
>>> regards,
>>>
>>>
>>> On Tue, Dec 29, 2020 at 8:26 AM Reneesh K <[email protected]> wrote:
>>>
>>>> How do I delete all files under a directory?
>>>>
>>>> --
>>>> 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/65531941-f099-417e-b5e6-3f26f0c96240n%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/ansible-project/65531941-f099-417e-b5e6-3f26f0c96240n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>
>>>
>>> --
>>> *---------------------*
>>> *Tej Singh Rana*
>>>
>>> --
>>> 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/CADBoQTpaj8C9-vtQbfAFh4rGy-Y%3Duo%3DdqJZUr%3D70G-zKheMj-Q%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/ansible-project/CADBoQTpaj8C9-vtQbfAFh4rGy-Y%3Duo%3DdqJZUr%3D70G-zKheMj-Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>>
> You received this message because you are subscribed to a topic in the
>> Google Groups "Ansible Project" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/ansible-project/0LPtwD5c2Yw/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CA%2BjXPxi0zOg0fdpYT4N4uRPjJVuazzX_m53gcY%2B-Rr1nyq_gTw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CA%2BjXPxi0zOg0fdpYT4N4uRPjJVuazzX_m53gcY%2B-Rr1nyq_gTw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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/CAP4UftRgUy7KbJkemG_TOtAVS3otzBpAwdNRoB_ATe2B%2B0c-Sg%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAP4UftRgUy7KbJkemG_TOtAVS3otzBpAwdNRoB_ATe2B%2B0c-Sg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CA%2BjXPxg4DvbOiNzOfVV%3DRP-gwCMKVvnrgWCKq3avae5Z2ZPqyA%40mail.gmail.com.

Reply via email to