我如何告诉 Salt Master 下载文件以供无法访问 Internet 的小兵使用?

How can I tell a Salt Master to download a file to make it available to minions that don't have access to the internet?

我有一些小黄人无法访问互联网,但我需要从网站上安装一个软件包。所以我需要让 master 下载文件,然后让 minion 从 master 拉取。理想情况下,master 会下载任何新版本的文件供 minions 使用。

根据您要下载的内容,我的 "easiest" 方法是进行某种编排:

  • 首先,您将 minion 运行 定位在您的 master 上(我假设您有一个),并使用一个方法来下载 Internet 文件并将其放置在 minion 可以访问的地方到它(http 服务器?salt 文件共享?网络驱动器等等)

  • 然后是所有 minion 检索文件并使用它的方法

编排配方必须位于 /srv/salt/orch/file_download.sls 下,例如

Master Download file:
  salt.state:
    - tgt: master-minion
    - failhard: True
    - sls:
      - recipe_to_download_file

Minion use file:
  salt.state:
    - tgt: * # or anything suitable to taget your minions
    - failhard: True
    - sls:
      - install_file

并启动它 salt-run state.orchestrate orch.file_download