Ansible:如何使用数组迭代角色? [英] Ansible: How to iterate over a role with an array?
本文介绍了Ansible:如何使用数组迭代角色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以像这样在循环中多次调用角色:
Is it possible to call a role multiple times in a loop like this:
vars:
my_array:
- foo
- bar
- baz
roles:
- role: foobar
with_items: my_array
我们该怎么做?
推荐答案
现在从 Ansible 2.3 开始支持.0:
- name: myrole
with_items:
- "aone"
- "atwo"
include_role:
name: myrole
vars:
thing: "{{ item }}"
这篇关于Ansible:如何使用数组迭代角色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文