how to use regex in copy or other module

I need to copy files from managed node to control machines.

A machine’s tomcat path : /usr/local/tomcat-aux
B machine’s tomcat path : /usr/local/tomcat-hk
actually there is not only these two instance.
so I’ve tried below methods, but failed.

name: copy file to tomcat path
copy: src=/deploy/a.conf dest=/usr/local/tomcat*/

Thanks in advance~

copy module doesn't support regexp, only a handful modules do, and if they do it's documented in the individual module documentation.

You example you can written like this:

- name: Find tomcat directories
   find:
     paths=/usr/local
     patterns=tomcat*
     file_type=directory
   register: result

- name: copy file to tomcat path
   copy:
     src=/deploy/a.conf
     dest={{ item.path }}
   with_items: result.files

Got it. thank you so much!

在 2016年10月2日星期日 UTC+8下午3:12:51,Kai Stian Olstad写道: