On 1/13/21 4:20 PM, Nithin Subbaraj wrote:
> Hi Racke,
> 
> Please find the below playbook details the username and path are test paths
> 
> ---
>  - name: Ansible archive Examples
>    hosts: all
>    tasks:
> 
>     - name : Find files ending with extensions
>       become: true
>       find:
>        paths:
>        - /home/nsubbaraj/replicate/vol/gunnsc01/prod/scoreout
>        recurse: yes
>        file_type: any
>        excludes:
>        - '*.gz'
>        - /home/nsubbaraj/replicate/vol/gunnsc01/prod/scoreout/delete
>        depth: 4
>        age: 7d
>        age_stamp: mtime
>       register: output
> 
>     - name: archive the files
>       become: yes
>       archive:
>         remove: yes
>         path: "{{ item.path }}"
>         dest: "{{ item.path }}-{{ansible_date_time.date.replace('-','')}}.gz"
>         format: zip
>       with_items: "{{ output.files }}"
> 
> ##############################
> 
> I am able to exclude the gzip files but not the delete directory files under
> /home/nsubbaraj/replicate/vol/gunnsc01/prod/scoreout/

I think the values for "excludes" need to be relative to the path(s), so try 
"delete"
instead of "/home/nsubbaraj/replicate/vol/gunnsc01/prod/scoreout/delete".

Regards
        Racke

> 
> On Wednesday, 13 January 2021 at 20:38:41 UTC+5:30 [email protected] wrote:
> 
>     On 1/13/21 3:58 PM, Nithin Subbaraj wrote:
>     >
>     > I have created an ansible playbook which finds files older than 7 days 
> and zips the files.
>     > Also  trying to exclude files from particular directory but not able to 
> find.
>     >
>     > I am not able to the exclude the files under sub directory ,it is also 
> getting zipped
>     > I am able to successfully exclude the already zipped files but not a 
> sub directory under the path
>     >
>     > using excludes in find module for compressing files older than 7 days
> 
>     Please share your playbook.
> 
>     Regards
>     Racke
> 
>     >
>     > --
>     > 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] 
> <mailto:[email protected]>.
>     > To view this discussion on the web visit
>     > 
> https://groups.google.com/d/msgid/ansible-project/0378a412-1a74-48d2-875a-45ccff472a8cn%40googlegroups.com
>     
> <https://groups.google.com/d/msgid/ansible-project/0378a412-1a74-48d2-875a-45ccff472a8cn%40googlegroups.com>
>     >
>     
> <https://groups.google.com/d/msgid/ansible-project/0378a412-1a74-48d2-875a-45ccff472a8cn%40googlegroups.com?utm_medium=email&utm_source=footer
>     
> <https://groups.google.com/d/msgid/ansible-project/0378a412-1a74-48d2-875a-45ccff472a8cn%40googlegroups.com?utm_medium=email&utm_source=footer>>.
> 
> 
> 
>     -- 
>     Ecommerce and Linux consulting + Perl and web application programming.
>     Debian and Sympa administration. Provisioning with Ansible.
> 
> -- 
> 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] 
> <mailto:[email protected]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/8882fa97-8657-486e-99a3-fbd7a5e964d2n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/8882fa97-8657-486e-99a3-fbd7a5e964d2n%40googlegroups.com?utm_medium=email&utm_source=footer>.


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
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/b756f1c4-2f67-8054-8dde-00f1fe556fc9%40linuxia.de.

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to