假设我有一本通常正常运行的剧本:
ansible-playbook -i hosts -e "var1=val1" \
-e "hosts=all" \
-e "devops_dir=$DEVOPS_PATH" \
-e "cname=something.gooten.com" \
-v playbook.yml
而且我想在启动Vagrantfile时运行它-
#
# Run Ansible from the Vagrant Host
#
config.ssh.insert_key = false
config.vm.provision "ansible" do |ansible|
ansible.playbook = "playbook.yml"
ansible.verbose = "v"
end
如何将-e
变量添加到Vagrantfile
中,以便它们也被调用?
答案 0 :(得分:0)
您必须使用extra_vars
ansible.extra_vars = {
var1: val1,
hosts: all,
devops_dir: $DEVOPS_PATH,
cname: something.gooten.com
}