VirtualBox is known to have poor performance in Windows — use VMware or see some possible solutions.

Installing Ansible

From the Ansible docs:

Currently Ansible can be run from any machine with Python 2.6 installed (Windows isn’t supported for the control machine). This includes Red Hat, Debian, CentOS, OS X, any of the BSDs, and so on.

If your host machine is running Windows, the workaround is to run Ansible on the VM (since it's running Ubuntu) and not locally. You do not need to install Ansible manually.

When you run vagrant up, the Vagrantfile will detect Windows and run the ansible_local provisioner. This provisioner installs Ansible and the external Ansible roles/packages on the VM (so you can also skip manually running the ansible-galaxy install command).

Running Ansible commands

With Ansible installed on your Vagrant VM, you must run Ansible commands on the VM, not on the Windows host.

Development server. The Ansible commands for the development machine are run for you automatically when you run vagrant up.

Remote servers (staging/production). To run the ansible-playbook commands to provision remote servers, you'll need to SSH in to the VM, cd to the directory with your Trellis files (~/trellis), then run the setup and deployment commands.

SSH forwarding

SSH forwarding requires that you use an authentication agent combined with an SSH client that can read and forward keys from the agent. On Windows, this is typically done with Pageant (agent) and PuTTY (client). On most Unix-based systems, the OpenSSH suite provides ssh-agent (agent) and ssh (client). Vagrant uses Net::SSH, which expects ssh-agent to be used.

If you're already using Pageant, then you can install ssh-pageant to act as a proxy between Pageant and ssh (or vagrant ssh), otherwise GitHub provides an excellent guide for automatically starting ssh-agent in Babun/Cygwin, Git for Windows, or any other Unix shell emulation on Windows. If you use cmder, then simply type agent in your console, and it will automatically load your keys and start the ssh-agent.

Improving performance with VirtualBox

VirtualBox on Windows is known to have poor performance when using synced directories with many files (for example - when developing with Sage)

This can be mitigated by installing the vagrant-winnfsd and vagrant-bindfs plugins. If both of these are installed, Trellis will detect and use them. No other software is required as the vagrant-winnfsd plugin comes bundled with WinNFSD.

Before running the initial vagrant up, make sure that both of these plugins are installed.

In addition, vagrant-winnfsd requires Administrator privileges when doing the initial provisioning. If UAC is enabled, make sure the initial vagrant up is run from a command prompt with elevated privileges (Run as Administrator).

WinNFSD is no longer being actively maintained, and there is currently no good replacement for Vagrant on Windows. If the vagrant-winnfsd plugin is not working in your environment, you can revert to the default VirtualBox folder sync method by doing a vagrant halt and uninstalling the vagrant-winnfsd plugin.

Other notes

There may also be issues with permissions/UAC and symlinks. See this comment.

Join over 6,000 subscribers on our newsletter to get the latest Roots updates, along with occasional tips on building better WordPress sites.

Looking for WordPress plugin recommendations, the newest modern WordPress projects, and general web development tips and articles?

“Easily the best WordPress email I get.” Colin OBrien

Follow us on Twitter @rootswp

Ready to checkout?