如何为盐状态定义 os 和 osversion?

How to define os and osversion for a salt state?

我有 top.sls:

base:
  '*':
    - core

  'os:Windows':
    - match: grain
    - repos.windows

如何不仅定义 os:Windows 还定义 osrelease:10

我试过'os:Windows,osrelease:10',但没用。

请注意:在这种特殊情况下,我可以使用 'osfullname:Microsoft Windows 10*',但是我想知道如何组合两个项目,例如 ososrelease

您必须使用 compound 匹配:

  'G@os:Windows and G@osrelease:10':
    - match: compound
    - repos.windows

您可以使用此技术进行花式匹配,例如混合谷物和柱状数据。

文档:https://docs.saltstack.com/en/latest/topics/targeting/compound.html