如下,with_items 是循环的对象,with_items 是 python list 数据结构,task 会循环读取 list 里面的值,key 的名称是 item
[[email protected] ~]$ cat while.yml --- - hosts: 192.168.119.134 user: root tasks: - name: touch file file: path=/tmp/{{ item }} state=touch mode=600 with_items: - 1.txt - 2.txt - 3.txt
原文地址:https://www.cnblogs.com/pzk7788/p/10215927.html
时间: 2024-10-12 12:21:52