【发布时间】:2018-11-23 08:57:33
【问题描述】:
我正在尝试包含所有主机,因为我想在其他主机配置中使用一个主机事实。
但我有
- 所有人的共同任务
- 两组共同的任务
- 单个小组的任务。
当我尝试以下方式时,所有任务都在所有主机上运行。如何确保在特定组中应用角色?
- hosts: Local:Global:Stream
tasks:
- include_role:
name: global
when: host in groups['Global']
- include_role:
name: local
when: host in groups['Local']
- include_role:
name: stream
when: host in groups['Stream']
【问题讨论】:
标签: ansible roles hosts ansible-inventory ansible-facts