添加索引
- hosts: all
tasks:
- name: debug
debug:
msg: "{{ item }}"
with_indexed_items:
- [1,2,3]
- ['a','b','c','d']
- hosts: all
tasks:
- name: debug
debug:
msg: "{{ item.0 }}"
with_indexed_items:
- [1,2,3]
- ['a','b','c','d']
- hosts: all
tasks:
- name: debug
debug:
msg: "{{ item.0 }} {{ item.1 }}"
with_indexed_items:
- [1,2,3]
- ['a','b','c','d']
标签:语句,tasks,name,items,debug,hosts,indexed
From: https://www.cnblogs.com/wangend/p/17062498.html