从 salt master 安装 WIndows 应用程序时出错

从 salt master 安装 WIndows 应用程序时出错

我正在尝试在 Windows Server 2012 R2 上通过 Salt 安装 Icinga。

我创建了一个 icinga.sls 文件并将其存储在 /srv/salt/win/repo-ng 中。

文件内容:

icinga:
  '2.4.7':
    full_name: 'Icinga2-v2.4.7'
    installer: 'salt://win/repo-ng/Icinga2-v2.4.7-x86.msi'
    uninstaller: 'http://packages.icinga.org/windows/Icinga2-v2.4.7-x86.msi
    install_flags: '/qn /norestart'
    uninstall_flags: '/qn /norestart'
    msiexec: True
    locale: en_US
    reboot: False

我还将 Icinga2-v2.4.7-x86.msi 文件复制到 /srv/salt/win/repo-ng。

我运行 salt minion_name pkg.refresh_db

我在服务器 2012 PC 上的 C:\salt\var\cache\salt\minion\files\base\win\repo-ng 中看到了 Icinga2-v2.4.7-x86.msi。

当我运行 salt minion_name pkg.install icinga 时,我得到以下返回结果,而当我检查我的服务器 2012 PC icinga 时未安装:

_comment:

        Software not found in the registry.
        Could be a problem with the Software
        definition file. Verify the full_name
        and the version match the registry exactly.
        Failed after 10 tries.

有人能告诉我我做错了什么吗?

我已经测试从附带的存储库安装 7-zip,并且运行良好。

另一件有趣的事情是,我有另一台 2012 服务器,我之前曾在该服务器上手动安装了 icinga 应用程序 - 我将其卸载并尝试用 salt 安装它,它确实安装了,但也出现了同样的错误,但安装工作正常。

我也尝试使用 64 位版本的 Icinga(Icinga2-v2.4.7-x86_64.msi)并相应地调整 icinga.sls 文件,但出现相同的错误。

Salt 是一个很棒的系统,但我需要使用它在 100 多台 PC 上安装 icinga,所以需要一个自动化系统 - 如果我可以使用 powershell 或类似的东西以另一种方式安装它,我也可以接受,但我想使用 salt 来安装。

提前感谢您的回复。

答案1

除了 Rob 的回答之外,为了区分 32 位 - 64 位安装,这是我的 /srv/salt/file/base/win/repo-ng/Icinga2/init.sls 示例文件:

Icinga2:
  {% for version in ['2.8.0','2.11.2','2.11.3'] %}
  '{{version}}':
    full_name: 'Icinga 2'
    {% if grains.get('cpuarch') == 'AMD64' %}
    installer: 'salt:///win/repo-ng/Icinga2/Icinga2-v{{version}}-x86_64.msi'
    uninstaller: 'salt:///win/repo-ng/Icinga2/Icinga2-v{{version}}-x86_64.msi'
    {% else %}
    installer: 'salt:///win/repo-ng/Icinga2/Icinga2-v{{version}}-x86.msi'
    uninstaller: 'salt:///win/repo-ng/Icinga2/Icinga2-v{{version}}-x86.msi'
    {% endif %}
    msiexec: True
    locale: en_US
    reboot: False
    install_flags: '/qn /norestart'
    uninstall_flags: '/qn /norestart'
    allusers: True
  {% endfor %}

/srv/salt/file/base/win/repo-ng/Icinga2 文件:

Icinga2-v2.11.2-x86_64.msi
Icinga2-v2.11.2-x86.msi
Icinga2-v2.11.3-x86_64.msi
Icinga2-v2.11.3-x86.msi
Icinga2-v2.8.0-x86_64.msi
Icinga2-v2.8.0-x86.msi
init.sls

答案2

我让它像这样工作:

首先我必须从 Windows 更新安装此知识库 https://support.microsoft.com/en-us/kb/2999226

然后我修改了 full_name 选项以匹配应用程序安装时显示的内容

全名:Icinga 2

然后我就可以毫无问题地安装和卸载 Icinga。

对于遇到同样问题的其他用户,请注意确保您使用与尝试安装 icinga 相同位版本的 salt-minion - 例如,我有 32 位 salt minion 并尝试安装 64 位 icinga,但失败并出现相同错误。将 salt-minion 重新安装为 64 位并按照上述说明操作,效果很好。

尽管我正在回答我自己的问题,但还是要感谢在这篇文章中帮助我的 David:

https://groups.google.com/forum/#!topic/salt-users/NstAv252vy0

相关内容