Пример использования find и loop модулей ansible



Не тестировано

- name: List files by pattern
  find:
    paths: 'mypath'
    patterns: "*.jar"
  register: myfiles

- name: copy files by pattern
  copy:
    src: '{{ file_item.path }}'
    dest: '/destination/{{ file_item.path | basename }}'
  loop: '{{ myfiles.files }}'
  loop_control:
    loop_var: file_item