一项任务中的 Ansible 数组
Ansible array in one task
我对 ansible 数组有疑问。
我有这样的任务:
tasks:
- name: create member and add to pool
bigip_pool_member:
pool: "{{pool_name}}"
partition: "{{partition}}"
host: "{{ip}}"
name: "{{ip}}"
port: "{{port}}"
monitors:
- "{{item}}"
loop: "{{monitor}}"
description: "{{description_member}}"
provider:
####
而且我想向池中添加多个监视器。只有它不起作用。我需要在一项任务中完成这项工作。我该怎么做?
循环将运行任务多次。看起来您应该直接将数组提供给任务:
- name: create member and add to pool
bigip_pool_member:
pool: "{{pool_name}}"
partition: "{{partition}}"
host: "{{ip}}"
name: "{{ip}}"
port: "{{port}}"
monitors: "{{monitor}}"
description: "{{description_member}}"
我对 ansible 数组有疑问。
我有这样的任务:
tasks:
- name: create member and add to pool
bigip_pool_member:
pool: "{{pool_name}}"
partition: "{{partition}}"
host: "{{ip}}"
name: "{{ip}}"
port: "{{port}}"
monitors:
- "{{item}}"
loop: "{{monitor}}"
description: "{{description_member}}"
provider:
####
而且我想向池中添加多个监视器。只有它不起作用。我需要在一项任务中完成这项工作。我该怎么做?
循环将运行任务多次。看起来您应该直接将数组提供给任务:
- name: create member and add to pool
bigip_pool_member:
pool: "{{pool_name}}"
partition: "{{partition}}"
host: "{{ip}}"
name: "{{ip}}"
port: "{{port}}"
monitors: "{{monitor}}"
description: "{{description_member}}"