在 Vagrant 中使用 SaltStack grains 文件
Using SaltStack grains file with Vagrant
我想使用 minion.d/*.conf
来配置一个 vagrant 机器。
这是我的 Vagrant 配置:
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 配置中进行同步配置吗?
您刚刚尝试将同步文件夹装载到 /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/"
@Utah_Dave的解决方案可以正常工作,或者您可以执行以下操作(我运行就是这样做的)。
文件系统:
/dev
Vagrantfile
salt-minion.conf
salt/
top.sls
my-awesome-state/init.sls
pillar/
top.sls
my-awesome-pillar.sls
Vagrantfile:
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
盐-minion.conf
file_client: local
id: awesome
file_roots:
base:
- /srv/salt/salt
pillar_roots:
base:
- /srv/salt/pillar
Vagrant 对 salt.grains_config 的实现不会将文件复制到 /etc/salt/minion.d 文件夹你可能会期待。相反,它将文件复制到 /etc/salt/grains.
要让 salt-minion 读取这个新的 grains 文件,您只需将以下内容添加到您的 minion 配置中:
/etc/salt/minion
include:
- /etc/salt/grains
我想使用 minion.d/*.conf
来配置一个 vagrant 机器。
这是我的 Vagrant 配置:
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 配置中进行同步配置吗?
您刚刚尝试将同步文件夹装载到 /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/"
@Utah_Dave的解决方案可以正常工作,或者您可以执行以下操作(我运行就是这样做的)。
文件系统:
/dev
Vagrantfile
salt-minion.conf
salt/
top.sls
my-awesome-state/init.sls
pillar/
top.sls
my-awesome-pillar.sls
Vagrantfile:
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
盐-minion.conf
file_client: local
id: awesome
file_roots:
base:
- /srv/salt/salt
pillar_roots:
base:
- /srv/salt/pillar
Vagrant 对 salt.grains_config 的实现不会将文件复制到 /etc/salt/minion.d 文件夹你可能会期待。相反,它将文件复制到 /etc/salt/grains.
要让 salt-minion 读取这个新的 grains 文件,您只需将以下内容添加到您的 minion 配置中:
/etc/salt/minion
include:
- /etc/salt/grains