Ansible copy module

 

 

  1. - hosts: gale
      remote_user: root
      gather_facts: no
      name: copy files
    
      tasks:
      - name: copy files
        copy:
          src: "{{ item.src }}"
          dest: "{{ item.dest }}"
        with_items:
        - { src: salamander, dest: /opt }
        - { src: salamander.pub, dest: /mnt }

     

  2. glob

     

     

     

     

    ---
    - hosts: gale
      remote_user: root
      gather_facts: no
      vars:
        filename: ~/salamander*
    
      tasks:
      - name: copy files with glob
        copy: src={{ item }} dest=/tmp
        with_fileglob:
        - "{{ filename }}"

     

posted @ 2021-08-19 17:47  ascertain  阅读(40)  评论(0编辑  收藏  举报