1

我想minion.d/*.conf用来配置一个流浪机器。这是我的流浪者配置:

Vagrant.configure("2") do |config|
  ## Choose your base box
  config.vm.box = "precise64"

  ## For masterless, mount your salt file root
  config.vm.synced_folder "salt/roots/", "/srv/salt/"

  ## Use all the defaults:
  config.vm.provision :salt do |salt|

    salt.minion_config = "salt/minion"
    salt.run_highstate = true
    salt.grains_config = "salt/minion.d/vagrant.conf"

  end
end

配置 Vagrant 机器后,我在渲染 SLS 文件时出错,因为这些minion.d/*.conf文件没有被复制到来宾机器下:

/etc/salt/minion.d/

我应该在 Vagrant 配置中对 co 进行同步配置吗?

4

3 回答 3

3

您是否刚刚尝试将同步文件夹安装到/etc/salt/grains

## For masterless, mount your salt file root
config.vm.synced_folder "salt/roots/", "/srv/salt/"
config.vm.synced_folder "salt/grains.d/", "/etc/salt/grains.d/"
于 2015-05-06T21:12:13.247 回答
3

@Utah_Dave 的解决方案可以正常工作,或者您可以执行以下操作(这就是我运行它的方式)。

文件系统

/dev
  Vagrantfile
  salt-minion.conf
  salt/
    top.sls
    my-awesome-state/init.sls
  pillar/
    top.sls
    my-awesome-pillar.sls

流浪文件

Vagrant.configure("2") do |config|
  config.vm.box = "mafro/jessie64-au-salt"

  # salt config directory & shared dir in /tmp
  config.vm.synced_folder ".", "/srv/salt"

  # setup the salt-minion
  config.vm.provision :salt do |salt|
    salt.minion_config = "salt-minion.conf"
  end
end

salt-minion.conf

file_client: local

id: awesome

file_roots:
  base:
    - /srv/salt/salt

pillar_roots:
  base:
    - /srv/salt/pillar
于 2015-05-08T01:48:01.533 回答
1

Vagrant 的salt.grains_config实现不会像您预期的那样将文件复制到/etc/salt/minion.d文件夹。相反,它将文件复制到/etc/salt/grains

要让 salt-minion 读取这个新的grains文件,您只需将以下内容添加到您的 minion 配置中:

/etc/salt/minion

include:
  - /etc/salt/grains
于 2016-02-12T01:09:28.250 回答