Recursive Copy In Ansible 1.5 And --diff
Ansible 1.5 has partial support for recursive copy of files:
where v= verbose, r = recursive, n = dry-run, c = check based on checksum, not timestamp+size; a typical output for a changed file is
- the synchronize module, using rsync
- cons: does not support group=, owner=
- -C and --diff - it does not print diff of the files changed; when running ansible with -v, it will print output of rsync's --itemize-changes, i.e., for each changed file/dir, something like "<f.st...... conf/httpd.conf\n" (< = file uploaded, s = size changed, t = timestamp changed, . = this attribute has not been changed)
- the copy module
- -C --diff - it only reports "changed" without naming the changed files or showing diffs (unless there is only one changed file)
- the local_action module, used to run rsync manually (essentially the same as synchronize but more control)
- So the only way to do a kind of recursive copy with working diff is to use
copy
with with_fileglob for each directory and subdirectory :-(
rsync -e ssh -vrnc --itemize-changes source/dir myuser@myserver:/opt/dest/
where v= verbose, r = recursive, n = dry-run, c = check based on checksum, not timestamp+size; a typical output for a changed file is
<fcsT...... httpd.conf
(< = to be uploaded, f = it is a file, c = checksum differ, s = size differ, T = timestamp would be updated).