节点组的top.sls文件中的Windows repo上的Pkg.install

时间:2015-09-02 09:13:16

标签: salt-stack

我按照以下指南介绍了如何设置windows software repository

我可以通过执行以下命令在节点上手动安装软件包:

salt node pkg.install 'firefox'

如何使用pkg.install(或类似的东西)将其转换为top.sls文件中的配置,以便我可以使用state.highstate定位节点组并仅安装以前未安装的软件?

使用Utah_Dave firefox的答案我将收到以下错误消息:(鉴于firefox已安装在计算机上,如果我进行全新安装,则错误消息/日志类似,并且firefox将安装在计算机上但仍然返回False)

my-node:
----------
          ID: firefox
    Function: pkg.installed
      Result: False
     Comment: The following packages failed to install/update: firefox=40.0.3

来自salt-minion的调试日志:

[DEBUG   ] Fetching file from saltenv 'base', ** attempting ** 'salt://firefox.sls'
[INFO    ] Fetching file from saltenv 'base', ** done ** 'firefox.sls'
[DEBUG   ] LazyLoaded cmd.run
[DEBUG   ] Jinja search path: ['c:\\salt\\var\\cache\\salt\\minion\\files\\base']
[DEBUG   ] Rendered data from file: c:\salt\var\cache\salt\minion\files\base\firefox.sls:
firefox:
  pkg.installed
[DEBUG   ] LazyLoaded config.get
[DEBUG   ] Results of YAML rendering:
OrderedDict([('firefox', 'pkg.installed')])
[DEBUG   ] LazyLoaded pkg.install
[DEBUG   ] LazyLoaded pkg.installed
[DEBUG   ] Error loading module.tls: ['PyOpenSSL version 0.14 or later must be installed before  this module can be used.']
[DEBUG   ] Error loading module.nacl: libnacl import error, perhaps missing python libnacl package
[DEBUG   ] Error loading module.ipmi: No module named pyghmi.ipmi
[DEBUG   ] Error loading module.npm: npm execution module could not be loaded because the npm binary could not be located
[DEBUG   ] Could not LazyLoad pkg.ex_mod_init
[INFO    ] Running state [firefox] at time 08:18:32.643000
[INFO    ] Executing state pkg.installed for firefox
[DEBUG   ] Initializing COM library
[DEBUG   ] Uninitializing COM library
[DEBUG   ] Could not LazyLoad pkg.normalize_name
[DEBUG   ] Could not LazyLoad pkg.check_db
[DEBUG   ] Could not LazyLoad pkg.normalize_name
[DEBUG   ] Initializing COM library
[DEBUG   ] Uninitializing COM library
[WARNING ] Specified file https://download-installer.cdn.mozilla.net/pub/firefox/releases/40.0.3/win32/en-US/Firefox%20Setup%2040.0.3.exe is not present to generate hash
[DEBUG   ] Reading configuration from c:\salt\conf\minion
[DEBUG   ] file_roots is c:\salt\srv\salt
[DEBUG   ] Using GET Method
[INFO    ] Executing command ['c:\\salt\\var\\cache\\salt\\minion\\extrn_files\\base\\download-installer.cdn.mozilla.net\\pub\\firefox\\releases\\40.0.3\\win32\\en-US\\Firefox%20Setup%2040.0.3.exe', '/s'] in directory 'C:\\Users\\aes.jenkins'
[DEBUG   ] Initializing COM library
[DEBUG   ] Uninitializing COM library
[DEBUG   ] Could not LazyLoad pkg.hold
[DEBUG   ] Initializing COM library
[DEBUG   ] Uninitializing COM library
[ERROR   ] The following packages failed to install/update: firefox=40.0.3
[INFO    ] Completed state [firefox] at time 08:18:46.939000

1 个答案:

答案 0 :(得分:0)

cat /srv/salt/firefox.sls:

firefox:
  pkg.installed

cat /srv/salt/top.sls:

base:
  'myNodeGroupName':
    - match: nodegroup
    - firefox