Copy multiple files with Ansible

前端 未结 11 1057
执念已碎
执念已碎 2021-01-29 22:29

How can I copy more than a single file into remote nodes by Ansible in a task?

I\'ve tried to duplicate the copy module line in my task to define files but it only copie

11条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-29 22:40

    If you need more than one location, you need more than one task. One copy task can copy only from one location (including multiple files) to another one on the node.

    - copy: src=/file1 dest=/destination/file1
    - copy: src=/file2 dest=/destination/file2
    
    # copy each file over that matches the given pattern
    - copy: src={{ item }} dest=/destination/
      with_fileglob:
        - /files/*
    

提交回复
热议问题