SpecialistOff.NET / Вопросы / Статьи / Фрагменты кода / Резюме / Метки / Помощь / Файлы

Список вопросов Печать

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


Метки: ansible 

Ответы

RemiZOffAlex  Создано: 2018-12-13 17:00:31.882136  Обновлено: 2018-12-13 17:00:31.882136

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

- 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

Возможно будут интересны и другие вопросы