On 01. okt. 2016 05:49, 郭大瞎 wrote:
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*/

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

--
Kai Stian Olstad

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d81052bd-e487-4b83-2b5b-aa33c19563ea%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to