Jef*_*uer 28
在Salt中,谷物用于你的小兵的不可变方面,例如cpu,记忆,位置,时区等.
支柱是您需要分发给您的小兵的主人(SLS格式)的数据列表.Pillar允许您设置小兵可以访问的变量,例如数据库配置选项.
ako*_*ian 15
这里的根本区别在于你可以将自定义纹理设置为一个小兵的固有属性,而不是支柱,它需要在某个时刻分配给一个小兵.
例如,有两种实用的方法可以将角色分配给一个小兵:小兵身份或使用自定义谷物.然后,您可以匹配top.sls文件中的minion id或自定义grain,如下所示:
# salt/top.sls
base:
# match against custom grain
'G@role:webserver':
- match: compound
- webserver
'G@role:search':
- match: compound
- elasticsearch
# match against minion id
'minion_db*':
- database
Run Code Online (Sandbox Code Playgroud)
你不能用柱子做这个.虽然你确实可以用柱子瞄准,但你首先需要一种方法来为你的仆从分配支柱(这必须是minion id,或者如上所述的颗粒).考虑如何在柱顶文件中分配柱子,您需要使用minion的固有属性来分配此柱状数据.
# pillar/top.sls
base:
'G@env:dev':
- match: compound
- dev_settings
'G@env:prod':
- match: compound
- prod_settings
Run Code Online (Sandbox Code Playgroud)
这里的模式是你使用grain(或minion id)作为设置你的小兵的类型/角色/环境的最小方法.之后,您使用支柱数据为其提供所有适当的详细设置.
uvs*_*tid 15
简而言之,自定义静态 Grains可能比Pillars更糟糕.
| Differences | Grains | Pillars |
|------------------------------|-------------------------------|-------------------------------------|
| This is info which... | ... Minion knows about itself | ... Minion asks Master about |
| | | |
| Distributed: | Yes (different per minion) | No (single version per master) |
| Centralized: | No | Yes |
| | | |
| Computed automatically: | Yes (preset/computed value) | No (only rendered from Jinja/YAML) |
| Assigned manually: | No (too elaborate) | Yes (Jinja/YAML sources) |
| | | |
| Conceptually intrinsic to... | ... individual Minion node | ... entire system managed by Master |
| Data under revision control: | No (computed values) | Yes (Jinja/YAML sources) |
| | | |
| They define rather... | _provided_ resources | _required_ resources |
| | (e.g. minion OS version) | (e.g. packages to install) |
| | | |
Run Code Online (Sandbox Code Playgroud)