Provisioning a Vagrant box: is Ansible installed on the guest or the host machine?

Hello,

I have a basic interrogation about Vagrant and Ansible.

Is Ansible installed on the guest machine or on the host machine?

In other words, is there a requirement for Ansible to be installed on the host machine ? (I am keen to avoid installing Ansible on the host machine).

Regards,

Julien.

The provisioner plugin for vagrant assumes ansible is installed on the host machine. If you’d like run ansible inside the guest, you’ll have to review the vagrant plugin and determine if it is capable.

True, need to be installed on the host. How about using vagrant shell script to install ansible inside guest and perform ansible-pull. Just my 2cents idea.

Hi everyone,

FYI: I have a work in progress to add this “guest mode” capability to the Vagrant Ansible provisioner. You can track progress in https://github.com/mitchellh/vagrant/issues/2103 and I hope to submit a first (basic) implementatin “asap”. Reviewers will be welcome, as always! It will not use ansible-pull, but ansible-playbook, as the playbook code will be shared from the host to the guest (via /vagrant synced folder, or similar).

@Rodney: indeed, It’s easy to first install ansible with a Vagrant Shell provisioner (e.g. based on your awesome PPA, thanks again by the way :). Ansible “Guest mode” with Vagrant can already be achieved as explained in this thread.

Note: T**heoretically such kind of discussions should rather be opened/searched in the Vagrant mailing list. Therefore I’d like to thanks @James and rest of Ansible crew to accept that such discussion also takes place in the very busy Ansible Groups. This Ansible community is awesome, thanks everyone!

Gilles

Puppet or chef are usually already part of the baseboxes. You can work the same way with ansible. Just build a basebox that has a working ansible (I use veewee[1] for automated building of those baseboxes). Then you can put all the ansible stuff in a subdirectory of your project dir and run the playbooks using the shell provisioner (using localhost and connection: local).

If someone asks why you would do this and not just use the host side installed ansible provisioner: This way you can easily reuse plays that you use for staging/production environments for your developer’s vagrant boxes, even if developers have the vagrant boxes running on windows or mac os hosts.

[1] https://github.com/jedi4ever/veewee

I’d disagree here.

The idea that shouldn’t need to install anything to manage the remote OS is very important to Ansible, and if you start building images with Ansible on it, you’ve lost some of the advantages, and also the ability to centrally manage multiple machines at once.

There’s a reason so many people using Vagrant go the Ansible route – not having to worry about the images is a large part of that.

That being said, if you’re running ansible-pull in prod, that WOULD actually be closer. (Not many people do)

I’d recommend still running things from the host.

I see your point, but I don’t see how this would work on windows machines. Vagrant is often used to bring Unix-Boxes to developers that have windows workstations.