标签:嵌套 one ignore bug ack book ems remote 列表
with_items 遍历列表中每个元素,包括嵌套列表示例:
[root@jack7-1 work]# ansible-playbook item_list.yml
PLAY [jack6_1] *****
TASK [debug] ***
ok: [jack6_1] => (item=1) => {
"msg": 1
}
ok: [jack6_1] => (item=2) => {
"msg": 2
}
ok: [jack6_1] => (item=3) => {
"msg": 3
}
ok: [jack6_1] => (item=a) => {
"msg": "a"
}
ok: [jack6_1] => (item=b) => {
"msg": "b"
}
TASK [debug] ***
ok: [jack6_1] => (item=[4, 5, 6]) => {
"msg": [
4,
5,
6
]
}
ok: [jack6_1] => (item=[u‘c‘, u‘d‘]) => {
"msg": [
"c",
"d"
]
}
TASK [debug] ***
ok: [jack6_1] => (item=[7, u‘e‘]) => {
"msg": [
7,
"e"
]
}
ok: [jack6_1] => (item=[8, u‘f‘]) => {
"msg": [
8,
"f"
]
}
ok: [jack6_1] => (item=[9, None]) => {
"msg": [
9,
null
]
}
PLAY RECAP *****
jack6_1 : ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
标签:嵌套 one ignore bug ack book ems remote 列表
原文地址:https://blog.51cto.com/13434656/2529207