@edmond_brakus
To pass Ansible variables into Vagrant, you can use the Vagrant Ansible provisioner. The Vagrant Ansible provisioner allows you to specify playbook paths, inventory files, extra variables, and other Ansible settings in your Vagrantfile.
Here is an example of how to pass Ansible variables into Vagrant using the Vagrant Ansible provisioner:
1 2 3 4 5 6 7 8 9 10 |
Vagrant.configure("2") do |config| config.vm.provision "ansible" do |ansible| ansible.playbook = "path/to/playbook.yml" ansible.inventory_path = "path/to/inventory" ansible.extra_vars = { var1: "value1", var2: "value2" } end end |
1 2 3 4 5 6 |
--- - name: Example playbook hosts: all tasks: - debug: msg: "Value of var1 is {{ var1 }} and value of var2 is {{ var2 }}" |
By following these steps, you can pass Ansible variables into Vagrant and use them in your Ansible playbooks to configure your virtual machines.