2016-02-05 20 views
0

我有以下狀態:鹽狀態:我可以決定安裝軟件包的順序嗎?

# windows.sls 

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

當執行salt -G 'os:Windows' state.highstate,這些軟件包安裝在不同的順序比SLS文件中指定。將使用的訂單可以通過運行salt -G 'os:Windows' state.highstate test=true進行預覽。

如何強制安裝軟件包的順序?

回答

0

一個簡單的方法是:

python2_x64: 
    pkg.installed 

vcforpython27: 
    pkg.installed 

# continue for all other packages ... 

Saltstack將使用文件中指定的順序安裝軟件包。

+0

此外,[命令選項](https://docs.saltstack.com/en/latest/ref/states/ordering.html#the -order-option)可以使用。該頁面還介紹瞭如何跳過訂購併使用「需求」決定需要先安裝哪些軟件包等。 – fredrik

1

你也可以使用要求或onlyif選項:

foo: 
    pkg.installed: 
    - require: 
     - bar 
foo: 
    pkg.installed: 
    - onlyif: 
     - bar 
相關問題