我试图设计一个相对复杂的系统,使用Vagrant和Salt-Stack来处理控制和配置。 基本思路是配置一台名为master的机器,它运行我所有其他机器将连接的Salt-Stack主机。
在之前的尝试中,我只是让Vagrant设置了一个Salt minion,它被指示安装salt master和dns服务器包。但我想通过使用Vagrant的设施来简化密钥传输。所以我想做的就是让Vagrant安装一个Salt master和一个minion,这样minion可以安装dns服务器,这样Vagrant可以为我移动我的键。
这是主要配置在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
但我收到的消息是:
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
当我看到master:/ var / log / salt / minion时,它是空的。
我的Vagrantfile配置中是否存在明显错误?任何提示?
答案 0 :(得分:2)
我发现这已经很久没有回答了。因此,我在这里发布我的个人最小Vagrant salt主文件。当我忘记在主服务器上设置salt-minion配置的master: localhost
条目时(默认情况下它会查找名为salt的主机),这个问题就出现了。
请注意,主人的主人有自己的钥匙。
这是运行vagrant 1.7.2并将安装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的配置文件:
# salt/master
# empty, use only defaults
Minion在master上的配置文件:
# salt/minion
master: localhost