Let's say i have a playbook that i normally run as follows:
ansible-playbook -i hosts -e "var1=val1" \
-e "hosts=all" \
-e "devops_dir=$DEVOPS_PATH" \
-e "cname=something.gooten.com" \
-v playbook.yml
And i want to have this run when i startup a 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
How do i add the -e
variables into the Vagrantfile
so that they are called as well?
You have to use extra_vars
ansible.extra_vars = {
var1: val1,
hosts: all,
devops_dir: $DEVOPS_PATH,
cname: something.gooten.com
}