【发布时间】:2016-11-10 01:30:27
【问题描述】:
我有一本这样的剧本,每个客户一个角色。
- hosts: hosting
roles:
- { role: client1, tags: ['client1'] }
- { role: client2, tags: ['client2'] }
例如,在每个角色上,我都依赖于 nginx。
/roles/client1/meta/main.yml
dependencies:
- nginx
我想在不需要时不启动 nginx 角色。所以我在依赖中添加了 nginx 标签。
/roles/client1/meta/main.yml
dependencies:
- { role: nginx, tags: ['system'] }
但是当我启动带有标签 client1 的剧本时,nginx 角色被执行。 有没有办法避免这种情况?
我知道可以“导出”对剧本的依赖,效果很好,但我认为这不是一个好的解决方案。
- hosts: hosting
roles:
- { role: nginx, tags: ['system'] }
- { role: client1, tags: ['client1'] }
- { role: client2, tags: ['client2'] }
【问题讨论】: