Anyone can able to help me.

Thanks,
Deepan M

On Wednesday, October 3, 2018 at 11:10:22 AM UTC+5:30, Deepan M wrote:
>
> Hello,
>
>  I'm writing a playbook for patching and in that i required  2 modules to 
> Find and Copy the recently modified file in remote machine , I have tried 
> with below modules, but not working! if  someone have an idea, kindly share.
>
> ::-Find and copy
>  - name: find recently modified file and copy it
>     find: path=/var/tmp/{{ansible_hostname}} patterns="*.tar.xz"
>   - name: copy files
>     fetch: path=/var/tmp/{{ansible_hostname}} dest=/kdump/sosreport/ 
> flat=yes
>
> ::- Try to find recently modified file.
> First play
>  - name: find recently modified file and copy it
>     find:
>       path: "/var/tmp/{{ansible_hostname}}"
>     register: found_files
>   - name: Get latest file
>     set_fact:
>       latest_file: "{{ found_files.files | 
> sort(attribute='mtime',age=-1h,reverse=true) | first }}"
>
> Second play
>  - name: find recently modified file and copy it
>     find:
>       path: "/var/tmp/{{ansible_hostname}}"
>     register: found_files
>   - name: Get latest file
>     set_fact:
>       latest_file: "{{ found_files.files | 
> sort(attribute='mtime',age=-1h,reverse=true) | first }}"
>   - name: print matches
>     debug:
>       msg: "{{ found_files.files }}"
>
>   - name: print matches
>     debug:
>       msg: "{{ found_files.files }}"
>
> Thanks,
> Deepan M
>
>

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/448d740e-8afa-40ee-bcf5-d5c6c41fdbfd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to