Copy Files To and From Remote Locations
1- name: Move foo to bar
2 command: mv /path/to/foo /path/to/bar
or check first and do a copy if it exist
1- name: stat foo
2 stat: path=/path/to/foo
3 register: foo_stat
4
5- name: Move foo to bar
6 command: mv /path/to/foo /path/to/bar
7 when: foo_stat.stat.exists
and, for ansible 2.0+, you can do:
1- name: Copy files from foo to bar
2 copy: remote_src=True src=/path/to/foo dest=/path/to/bar