vagrantvagrantfilesalt-projectvagrant-plugin

Using SaltStack grains file with Vagrant


I would like to use minion.d/*.conf to provision a vagrant machine. Here is my Vagrant configuration:

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

After provisioning the Vagrant machine, I have errors with rendering SLS files since the minion.d/*.conf files are not being copied to the guest machine under :

/etc/salt/minion.d/

Should I make a sync config in the Vagrant configuration to co ?


Solution

  • Have you just tried mounting a synced folder to /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/"