# Ansible + Vagrant question please

**URL:** <https://forum.ansible.com/t/ansible-vagrant-question-please/21894>\
**Category:** Ansible Project\
**Created:** [June 29, 2016, 8:16pm UTC](https://forum.ansible.com/t/ansible-vagrant-question-please/21894 "2016-06-29T20:16:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sargon](https://avatars.discourse-cdn.com/v4/letter/s/9e8a1a/32.png) [@Sargon](https://forum.ansible.com/u/Sargon)\
**Post date:** [June 29, 2016, 8:16pm UTC](https://forum.ansible.com/t/ansible-vagrant-question-please/21894/1 "2016-06-29T20:16:16Z")

</div>

I want to create a Virtualbox VM and provision it.

Now I can run:

`vagrant init bento/centos-6.7; vagrant up --provider virtualbox`

`And it's there.`

`I can put this command as a local command in Ansible, but I gather there is a Vagrant module as well, which is probably more involved.`

`Is there a good reason why I should grok the Vagrant module to do this when a simple command will do?`

`I prefer that it looks more professional and robust, and not so "hacky" but simple is good.`

`Thanks`

---

<div class="post-metadata">

**Author:** ![sdarwin](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sdarwin/32/2450_2.png) [@sdarwin](https://forum.ansible.com/u/sdarwin)\
**Post date:** [July 3, 2016, 3:41pm UTC](https://forum.ansible.com/t/ansible-vagrant-question-please/21894/2 "2016-07-03T15:41:07Z")

</div>

Test Kitchen is a great way to test virtualbox instances, and here is an ansible provisioner: [https://github.com/neillturner/kitchen-ansibleThat](https://github.com/neillturner/kitchen-ansibleThat) will both launch and provision the machine.

Or, configure ansible directly in Vagrant: [http://docs.ansible.com/ansible/guide\_vagrant.html](http://docs.ansible.com/ansible/guide_vagrant.html) . In this case, you would still need to start and stop the vm, as you had written.

---

<div class="post-metadata">

**Author:** ![Joaquin\_Menchaca](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@Joaquin\_Menchaca](https://forum.ansible.com/u/Joaquin_Menchaca)\
**Post date:** [July 5, 2016, 8:25pm UTC](https://forum.ansible.com/t/ansible-vagrant-question-please/21894/3 "2016-07-05T20:25:37Z")

</div>

For single machine, Vagrant’s built in ansible provisioner is good. For multi-machine, you could consider using the dynamic inventory (slooow), or better, just source a configuration file (json, yaml, csv, ini, whatever) from the Vagrantfile and from a dynamic inventory.

I created some example scenarios where, Vagrant, Shell Scripts, and Ansible dynamic inventory from a config file (one source of truth):

- [https://bitbucket.org/jmenchaca/vagrant-simple](https://bitbucket.org/jmenchaca/vagrant-simple)

The only draw back, is that it doesn’t reflect current state of the systems (that they are running), only that they are configured to run, and how to access them through Vagrant’s private key.
