0

我正在尝试使用带有现有盐公式的盐来配置 vagrant VM。我已按照此演示文稿访问gitfs_remoteshttps ://github.com/borgstrom/salt-vagrant-saltconf2014/blob/master/presentation.md 。

盐/奴才

master: 127.0.0.1
state_verbose: False

盐/大师:

# listen on the loopback in open mode
interface: 127.0.0.1
auto_accept: True

# use both the local roots as well as gitfs remotes
fileserver_backend:
  - roots
  - git

# map our project specific files to the local roots
file_roots:
  base:
    - /vagrant/salt/roots
pillar_roots:
  base:
    - /vagrant/salt/pillar

# setup our salt formulas as gitfs remotes
gitfs_remotes:
  - https://github.com/saltstack-formulas/mysql-formula

流浪文件(部分):

config.vm.synced_folder "salt/roots/", "/srv/salt/"
config.vm.synced_folder "salt/pillar", "/srv/pillar/"

config.vm.provision :salt do |salt|
    salt.minion_config = "salt/minion"
    salt.master_config = "salt/master"
    salt.bootstrap_options = "-F -c /tmp/ -P"
    salt.run_highstate = true
end

/salt/roots/top.sls:

base:
  '*':
    - mysql

但我得到了错误:

[信息] SaltReqTimeoutError:60 秒后。(尝试 7 次,共 7 次)尝试向 salt master 进行身份验证失败

4

2 回答 2

2

masterless minion 可以在没有明确配置的 master 的情况下使用 gitfs。saltstack/salt 中存在问题。

查看saltstack/salt-bootstrap中的这个问题,了解为什么要使用 bash 配置在前面安装东西的详细信息。

这是使用节点公式的工作配置。

流浪文件

Vagrant.configure(2) do |config|
  config.vm.box = "debian/jessie64"

  # mount state tree and pillar
  config.vm.synced_folder ".saltstack/salt/", "/srv/salt/", type: "rsync"
  config.vm.synced_folder ".saltstack/pillar/", "/srv/pillar/", type: "rsync"

  # install those to be able to use gitfs for node formula
  # @see https://github.com/saltstack/salt-bootstrap/issues/245
  config.vm.provision :shell, :inline => "sudo apt-get -y install git-core"
  config.vm.provision :shell, :inline => "sudo apt-get -y install python-setuptools"
  config.vm.provision :shell, :inline => "sudo easy_install GitPython"

  config.vm.provision :salt do |salt|
    # Workaround for:
    # Copying salt minion config to /etc/salt
    # Failed to upload a file to the guest VM via SCP due to a permissions
    # error. [...]; @see:
    # https://github.com/mitchellh/vagrant/issues/5973#issuecomment-137276605
    salt.bootstrap_options = '-F -c /tmp/ -P'
    salt.masterless = true
    salt.minion_config = ".saltstack/minion"
    salt.run_highstate = true
    salt.verbose = true
  end

  # sync working dir
  config.vm.synced_folder ".", "/vagrant", type: "rsync",
    rsync__exclude: [".git/", ".saltstack"]
end

.saltstack/minion

state_verbose: True

file_client: local

gitfs_provider: gitpython

fileserver_backend:
  - roots
  - git

gitfs_remotes:
  - https://github.com/saltstack-formulas/node-formula.git
于 2016-03-09T21:36:09.607 回答
-1

您收到该错误是因为当一个 minion 连接到 Salt Master 时 - 该请求必须得到 Salt Master 的批准。它就像一个安全机制——第一次需要批准,第二次使用机器的指纹。在您的盐大师运行中:

sudo salt-key

您应该会看到类似的内容,并且您会注意到新机器的密钥尚未被接受。

Accepted Keys: Denied Keys: Unaccepted Keys: xyz.hostname.com Rejected Keys:

继续运行命令:

sudo salt-key -A

在确认时说是,密钥将被接受,错误应该消失。还要测试 minion 是否可以在 master 上运行命令:

sudo salt '*' test.ping

这应该从 minions 返回 true。

最后使用一个久经考验的项目,比如Salt 团队的这个项目或我编写的一个项目,你会很快开始使用 Salt。

于 2015-11-16T11:21:28.153 回答