ansible/ansible-modules-core — pull request #337 by johnpbatty (2014-11-15 23:09:32+00:00)
Title: Fixed copy when dest is directory and force=no

If the copy module is used to copy files with dest= and
force=yes (or omitted - this is the default), then the files are copied
as expected.

If force=no (only transfer file if destination does not exist), then
the files are NOT copied. This is because the current code is
erroneously checking for the existence of the destination directory
rather than the destination files.

Example playbook that demonstrates the problem…
```
---
- hosts: localhost
gather_facts: no

tasks:
- name: Copy files
local_action: copy >
src="{{ item }}"
dest=target_dir
force=no
with_items:
- test1.txt
- test2.txt
```
Also create test1,txt, test2.txt files, and “target_dir” directory.
Expected result is that test1.txt and test2.txt are copied to dest_dir.