copy multiple files

Is there a way to copy multiple files with a single command? The copy module doesn’t seem to handle “*.conf” for example. I often want to deploy an entire folder containing multiple files and it would be tedious to have to specify each file individually. Is there a way to do this? (I know there is the git module, but in many cases that would be over-kill.)

Dan

I have use rsync with a local_action for something similar, but yes a "copy directory" or even an rsync module would be nice.

   tasks:

   - name: install prereqs for ansible
     action: apt pkg=$item
     with_items:
       - python-yaml
       - python-paramiko
       - python-jinja2

   - name: create /export directory
     action: command mkdir -p /export/ansible creates=/export/ansible

   - name: rsync (push) ansible
     local_action: command rsync --delete -uaSHAXEx /export/ansible/ansible $inventory_hostname:/export/ansible

There's an outstanding pull request for making copy recursive if the
source is a directory.

You can use with_fileglob to have copy module iterate over the *.conf

Brian Coca

Just to be clear, that pull request will follow folders as well if it’s in the source directory?