Ansible modules use

 

- hosts: woshi129
  tasks:
    - name: copy /etc
      copy:
        src: "{{ item }}"
        dest: /root/ooo/
      with_fileglob:
        - /data/ppp/*
    - name: combine
      command: echo "msg={{ item.0 }} and {{ item.1 }}"
      with_together:
        - [1,2,3]
        - ['a','b']

 

 with_fileglob: Transfer all files under the file as variables, but not recursively.

 with_together: transfer variables in the form of a list combination

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324385548&siteId=291194637