Why doesn't the Ansible copy module copy this dir?

ansible

Solution

Not sure why `copy` fails, but the solution was to use `synchronize` instead. This works:

- name: vim files
  synchronize:
    src=/absolute/repo/path/roles/common/files/{{ item.src }}
    dest={{ item.dst }}
  with_items:
    - {src: vim/bundle, dst: /home/jefdaj/.vim  }
    - {src: vim/vimrc , dst: /home/jefdaj/.vimrc}
    - {src: vim/bundle, dst: /root/.vim         }
    - {src: vim/vimrc , dst: /root/.vimrc       }

- name: vim permissions
  file: path={{ item.pth }} owner={{ item.own }} group={{ item.grp }} recurse=yes
  with_items:
    - {pth: /root/.vim         , own: root  , grp: root  }
    - {pth: /root/.vimrc       , own: root  , grp: root  }
    - {pth: /home/jefdaj/.vim  , own: jefdaj, grp: jefdaj}
    - {pth: /home/jefdaj/.vimrc, own: jefdaj, grp: jefdaj}

I had to hardcode the base path because it doesn't seem to handle relative ones properly.

Problem

This should be easy, but I've been trying for an hour. My code gets Ansible to copy `.vimrc` to each host, but `.vim` is silently ignored. ``` --- - name: vim pkg apt: pkg=vim state=installed - name: vim dirs file: path=/home/jefdaj/.vim state=directory file: path=/root/.vim state=directory - name: vim files # these work copy: src=vim/vimrc dest=/home/jefdaj/.vimrc force=yes copy: src=vim/vimrc dest=/root/.vimrc force=yes # but these don't copy: src=vim/bundle dest=/home/jefdaj/.vim/bundle force=yes recurse=yes copy: src=vim/bundle dest=/root/.vim/bundle force=yes recurse=yes ``` What's up with that? I've tried lots variations on the paths. It happens in ansible 1.5.5 on Debian, and also on the current git version. EDIT: Now it tries to copy, but always fails while creating one of the many dirs with an error like `OSError: [Errno 2] No such file or directory: '/root/.vim/bundle/bundle/vim-easymotion/autoload/vital/Over'`

Original source