Roots Discourse

Can't deploy from local vagrant


This is an issue we’ve been experiencing ever since trying to deploy Trellis from Windows computers. I’ve tried replicating the issue from my own computer (OSX) and it is exactly the same.

Since ansible doesn’t run on Windows the appropriate workflow to deploy from windows machine is to ssh into the local vagrant box (with ssh vagrant) and move to the trellis directory (~/trellis) then run the commands from there.

I’ve tried running the commands from both ~/trellis and /vagrant but I always get the ./bin/ line 45: ansible-playbook: command not found.

Everything works as expected if I deploy the site from OSX with ansible installed rather than connecting to the host machine and trying to deploy from there.


Did you follow the documentation to install Ansible on the VM?


Is your vagrant box provisioned? I don’t know how you could SSH in without it being provisioned since it happens on the first vagrant up, unless there was an error.


There is no need to install ansible on the VM manually when running from windows correct? @MWDelaney


I’m going by the error ,essage you received: ansible-playbook: command not found.

This tells me the command isn’t available, and so ansible isn’t installed on your VM.


If I try to install it in my VM via ansible-galaxy install I get the exact same error.


ansible-galaxy install doesn’t install Ansible, it installs your project’s required Ansible roles.

To test whether Ansible is installed on your VM, try to ssh to the VM and run ansible --version.


No this should be one of the first things done during the provision.


@kalenjohnson it seems to me that Ansible just isn’t installed on the VM.

@zigav can you try backing up your database and doing (whatever the Windows equivalent of) vagrant destroy && vagrant up to see if it just went wrong the first time?


Right, that’s what i mean, if Ansible is not installed on the host machine then it should be installed first thing on the VM.


Did you ever find the solution for this on Windows?

I also get the “ansible-playbook: command not found” error when running:
./bin/ staging

Update: seems like I have to vagrant ssh and cd trellis to run this command
You get more errors due to the formatting of windows files but you can fix those using this sublime text guide:


See “Running Ansible Commands” here:


Thanks, yes, I figured this much out I think.

I can SSH to my server from command prompt but I cannot run ./bin/ due to it not being available on windows.

If I vagrant SSH to run the command then the script does run but in the end I am presented with a
SSH Error: data could not be sent to remote host - UNREACHABLE! message.

I’ll try again but I have no idea where to start at the moment. My best guess is that my local windows isn’t being sent by vagrant? Maybe vagrant sends it’s own key files with this method?

I wonder if there is an easy way to deploy directly if I ssh to the remote server?


Not that’s supported by Trellis.

Have you read the section of that same page about key forwarding?


I have indeed. I am using the Git shell that comes with Git for Windows so ssh-agent should be automatically launched, according to the article that is linked in the docs.

I have tried this with putty too and enabled agent forwarding. Same result.

UPDATE: Still not working and I have tried the following:

If anybody has any ideas they would be much appreciated. For the moment I have to get my Mac developer to deploy the code. :expressionless:


I’m still having problems with this one.

I can actually SSH to the remote server from within the vagrant box, so SSH keys are clearly being sent by vagrant.

I had a theory that the ‘root’ username was not being passed to the server when issuing the deploy command from the vagrant box. Perhaps I need to configure something differently?

If I update my hosts/staging file to the following:



Then I get a little further. A different error is produced though:

TASK [deploy : Install npm dependencies] *******************************************************************************
System info:
Ansible 2.7.5; Linux
Trellis 1.0.0: December 27th, 2018

[Errno 2] No such file or directory
fatal: [root@XXX.XXX.XXX.XXX -> localhost]: FAILED! => {“changed”: false, “cmd”: “yarn”, “rc”: 2}