-
-
Notifications
You must be signed in to change notification settings - Fork 641
Use Ansible inside VM if Ansible is not present on the host #199
Comments
Valkyrie does something like this: https://github.com/GetValkyrie/valkyrie It installs Ansible inside the vm via the shell provisioner, and then runs another shell provisioner to actually run the playbooks. Another option is to get the ansible_guest provisioner into Vagrant itself, which does exactly what you (and many other people) are looking for: hashicorp/vagrant#5340 |
@dsnopek @cweagans - Ansible does work great inside the VM—in fact, if you're on one of those pesky Windows systems, that's how it is installed and used. However, there are many advantages to running Ansible from the host machine:
Additionally, you technically don't need to use Just be lucky I don't (as many other projects do, for some incredibly and painfully insane reason) tell you to run You can tell Ansible to install roles anywhere you want (in |
Since you're the second person who's stated apprehension about running a command with sudo to do some of the setup process (in addition to VirtualBox and Vagrant installation requiring sudo, though through a friendly UI dialog), I may document why the example is so, and also add a page in the official docs about Ansible usage and where to get more info. A couple relevant Ansible resources (besides the official docs): |
There's also a good reason to do it inside the vm: people at a training need a box to develop with, and it's easiest to do that with as few host dependencies as possible. Then again, if they're already installing vbox and vagrant, what's one more thing? |
Maybe check if ansible-playbook is available instead of checking for windows? This is what phansible does: https://github.com/phansible/phansible/blob/master/Vagrantfile#L25 Would it be possible to add the roles path argument to ansible-galaxy? At one time was working on a patch for extra arguments to the vm. |
@joestewart - Hmm... that's intriguing, I could do that, and change readme/quick start guide to just mention "if you want to install and use ansible on your host machine (highly recommended), do the following..." It's still nicer output and faster to install on host then use for every subsequent VM build, so I'm a bit torn. I hate making beginner users (who would be most likely to skip the optional host install) spend another minute or two (especially if they're on slower connections) while the VM gets Ansible installed inside. But I'm leaning the way Phansible does it. That could be a happy medium. |
Thanks everyone for all the feedback! Part of my apprehension to this was that I don't know Ansible or use it for any of my other VMs. Since there are so many provisioning tools, and I'm as likely to use a VM created by myself (I know/use Puppet) as a VM created by someone else (could use anything), it's nice to be able to ignore which provisioning tool is used and just say "VM go now" (I mean "vagrant up") without doing anything my host system. :-) I understand @geerlingguy's perspective, that if you have lots of VMs using Ansible, there could be some efficiencies by installing on the host system. But I would guess that isn't the case for most potential users? A "zero setup" default plus some documentation on how to make things more efficient makes more sense to me from my perspective. It could make it easier to for more new users to adopt drupal-vm at first, and then as they become used to it and want to make it better/faster, they could do more configuration. |
I see value in this one. Although it won't affect me directly, I feel that when I finally distribute my VM package I'm working on, it would be better (for my colleagues) to have less to muck around with. |
I've completed half the work for this issue... will update documentation when I get a moment later. |
Cool! Thanks for addressing this. :-) |
You can now install Drupal VM on any platform even if Ansible isn't installed :) |
Remaining Tasks
which
method to Vagrantfile and use it instead ofis_windows
to determine whether to run windows.sh shell provisioning script.Original Issue
In the current install instructions, you have to install ansible on the host machine and run
sudo ansible-galaxy install -r provisioning/requirements.txt --force
on the host. When I was first trying out drupal-vm, I actually stopped at this point because it seemed suspect and didn't want to have to install something globally on my host system. (Eventually, I came back after too many people gave recommendations to use drupal-vm ;-))The reason is that I do everything in VMs (I have 32G of RAM and run several VMs), most using vagrant with Puppet or Chef for provisioning -- however, Puppet or Chef is installed inside the VM and nothing needs to be changed on my host system.
Would it be possible to install Ansible inside the VM so that nothing on the host system needs to be changed?
I have no experience with Ansible, so it's posible that this is how Ansible must work. However, Puppet and Chef have a "local mode" where it run directly on the local machine (rather than remotely logging into another machine and running there, which is what you'd generally do in production).
Thanks!
The text was updated successfully, but these errors were encountered: