2
votes

I'm trying to design a relatively complex system, using Vagrant and Salt-Stack to handle control and provisioning. The basic idea is to provision a machine, called master, which runs the Salt-Stack master that all my other machines will connect to.

In a previous attempt to do this, I just had Vagrant set up a Salt minion which was instructed to install the salt master and a dns server package. But I'd like to simplify key transports by using Vagrant's facilities. So what I'd like to do is have Vagrant install a Salt master and a minion, so that the minion can install the dns server, and so that Vagrant can move my keys around for me.

Here is what master's configuration looks like, in the Vagrantfile:

config.vm.define :master do |master|
  master.vm.provider "virtualbox" do |vbox|
    vbox.cpus = 1
    vbox.memory = 384
  end

  master.vm.network "private_network", ip: "10.47.94.2"
  master.vm.network :forwarded_port, guest: 53, host: 53
  master.vm.hostname = "master"
  master.vm.provision :salt do |salt|
    salt.verbose = true
    salt.minion_config = "salt/master"
    salt.run_highstate = true

    salt.install_master = true
    salt.master_config = "salt/master"    
    salt.master_key = "salt/keys/master.pem"
    salt.master_pub = "salt/keys/master.pub"
    salt.minion_key = "salt/keys/master.pem"
    salt.minion_pub = "salt/keys/master.pub"
    salt.seed_master = {master: "salt/keys/master.pub"}
    salt.run_overstate = true
  end
end

But I am getting the message:

Executing job with jid 20140403131604825601
-------------------------------------------

Execution is still running on master
Execution is still running on master
Execution is still running on master
Execution is still running on master
master:
    Minion did not return

and when I look at master:/var/log/salt/minion, it's empty.

Is there an obvious error in my Vagrantfile configuration? Any hints?

1
salt.seed_master = {master: "salt/keys/master.pub"}...Is your minion ID == master? - Keenan
Yeah, by setting master.vm.hostname = "master". I ended up splitting up the salt provisioning step into two calls to vm.master.provision. One installs the salt minion and runs high_state, and the next one installs the master and keys. - nomen
Ah, didn't see that line. That was the only thing saw...did splitting it up work? - Keenan
Is the salt-minion installed and running? If /var/log/salt/minion is empty, it could possibly mean that the salt-minion hasn't been running if installed. - nmadhok
Are you sure you don't want run_highstate=false? - nsfyn55

1 Answers

2
votes

I see that this has not been answered for a long time. Therefore I post my personal minimal Vagrant salt master file here. This problem occured to me once when I forgot to setup the master: localhost entry to the salt-minion configuration on the master (as default it looks for a host called salt).

Please note that the minion on the master has its own key.

This is running vagrant 1.7.2 and will install a salt master 2015.5.0

# Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.vm.box = "chef/centos-7.0"

  # Deployment instance salt master
  config.vm.define :master do |master|
    master.vm.network :private_network, ip: "192.168.22.12"
    master.vm.hostname = 'master'

    master.vm.synced_folder "salt/roots/", "/srv/"

    master.vm.provision :salt do |config|
      config.install_master = true
      config.minion_config = "salt/minion"
      config.master_config = "salt/master"
      config.minion_key = "salt/keys/minion.pem"
      config.minion_pub = "salt/keys/minion.pub"
      config.master_key = "salt/keys/master.pem"
      config.master_pub = "salt/keys/master.pub"
      config.seed_master =
        {
          master: "salt/keys/minion.pub"
        }
      config.run_highstate = true
    end
  end

end

Master's configuration file:

# salt/master
# empty, use only defaults

Minion's configuration file on master:

# salt/minion
master: localhost