如何使用Salt pkg.installed模块安装本地rpm

问题描述 投票:0回答:1

我们想要在CentOS 6和7机器上安装一些.rpm应用程序。这些机器无法访问互联网。我们如何编写一个确保安装应用程序的状态?这是我的代码:

Install Nessus Agent:
  pkg.installed:
    - name: NessusAgent
    - sources: '[{"NessusAgent": "salt:///root/NessusAgent-7.1.1-es{{ osmajorrelease }}.x86_64.rpm"}]'

我运行状态时遇到的错误:

     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/lib/python2.7/site-packages/salt/state.py", line 1913, in call
                  **cdata['kwargs'])
                File "/usr/lib/python2.7/site-packages/salt/loader.py", line 1898, in wrapper
                  return f(*args, **kwargs)
                File "/usr/lib/python2.7/site-packages/salt/states/pkg.py", line 1617, in installed
                  if next(iter(list(x.keys()))) in targets]
              AttributeError: 'unicode' object has no attribute 'keys'

使用Salt状态安装本地rpm包的正确方法是什么?

yum salt
1个回答
0
投票

我通过重写“sources”参数让它工作:

Install Nessus Agent:
  pkg.installed:
    - name: NessusAgent
    - enable: True
    - sources:
      - NessusAgent: salt:///files/nessus/NessusAgent-7.1.1-es7.x86_64.rpm
© www.soinside.com 2019 - 2024. All rights reserved.