盐态:我可以决定安装包的顺序吗?

Salt state: can I decide the order in which packages are installed?

我有以下状态:

# windows.sls

windows:
  pkg.installed:
    - pkgs:
      - python2_x64
      - vcforpython27

执行 salt -G 'os:Windows' state.highstate 时,这些包的安装顺序与 sls 文件中指定的顺序不同。可以通过运行 salt -G 'os:Windows' state.highstate test=true.

预览将要使用的顺序

如何强制安装软件包的顺序?

一个简单的方法是:

python2_x64:
  pkg.installed

vcforpython27:
  pkg.installed

# continue for all other packages ...

Saltstack 将使用文件中指定的顺序安装包。

你也可以使用 require 或 onlyif 选项:

foo:
  pkg.installed:
    - require:
      - bar
 foo:
  pkg.installed:
    - onlyif:
      - bar