ansible: why is the file module skipping?
From documentation:
Remember lookup plugins are run on the "controlling" machine:
with_fileglob
is a lookup plugin, so it looks for files on the local server, the one you are running ansible-playbook from.
Here is what you can do:
- name: list files
action: command ls -1 /to/*
register: dumpfiles
- name: change ownership
action: file path=$item owner=newuser group=newgroup
with_items: ${dumpfiles.stdout_lines}
Ansible 1.1 added the recurse parameter to the file module, so all you need to do for your change ownership task is this:
- name: change ownership
action: file state=directory recurse=yes path=/to/ owner=newuser group=newgroup
This will make it more apparent when actually things change; using the shell or command modules will always return a changed status, even if nothing was actually changed.