Reputation: 551
I am trying to copy a script to a remote machine and I have to preserve mtime
of the file.
I have tried using mode:preserve
and mode=preserve
as stated in ansible documentation, here!
but it seems to preserve permissions and ownership only.
- name: Transfer executable script script
copy:
src: /home/avinash/Downloads/freeradius.sh
dest: /home/ssrnd09/ansible
mode: preserve
Upvotes: 0
Views: 1480
Reputation: 12145
In respect to your question and the comment of Zeitounator, I've setup a test with synchronize
_module and with parameter times
, which was working as required.
---
- hosts: test.example.com
become: no
gather_facts: no
tasks:
- name: Synchronize passing in extra rsync options
synchronize:
src: test.sh
dest: "/home/{{ ansible_user }}/test.sh"
times: yes
Thanks to
Upvotes: 1