Deploy bedrock from windows to Digital Ocean with ansible


I have been working to make bedrock-ansible, bedrock, sage working in the past 4 days. Im almost in the finish, but I have some problems with deploying to production server.

I dont really know from where should I run the deploy script. Should I run it from vagrant box or from windows console?

When I’m trying to run the command from windows (babun cygwin) im getting this error:

{ ansible } master » ./ hosts/production
: invalid shell option name nullglob
./ line 3: $'\r': command not found
./ line 8: $'\r': command not found
./ line 9: syntax error near unexpected token `$'{\r''
'/ line 9: `show_usage() {

… than i tried to run the playbook command directly:

{ ansible } master » ansible-playbook -i hosts/production deploy.yml --extra-vars="" -vvvv

PLAY [Deploy WP site] *********************************************************

GATHERING FACTS ***************************************************************
<> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/ROBI/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1433972511.14-229562164514219 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1433972511.14-229562164514219 && echo $HOME/.ansible/tmp/ansible-tmp-1433972511.14-229562164514219'
fatal: [] => SSH Error: Permission denied (publickey,password).
	while connecting to
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.

The ssh is working correctly I can easily ssh in. If I run the ssh command directly the problem is different. The ControlPath="/home/ROBI/.ansible/ not found. And yes its not there.

When I tried to run the deploy script from vagrant than I got into the executables problem than many others reported already.

My question after this: Is it possible to depkoy sites with ansible from windows? If yes, what am I doing wrong?

Thank you!


On Windows, Ansible is installed to the VM, and the VM basically provisions itself (as opposed to an OS X or Linux host, where Ansible is installed on the host machine and provision the VM).

In order to keep instructions the same, it’s expected on Windows to SSH into the box and run the same commands to deploy as are in the README.

What “executables problem” are you experiencing?

And sorry to say, although I set up the provisioning for Windows, I have not tested it much deploying, although since it is an Ubuntu VM, and I run Ubuntu as my host, it should work without much issue. But perhaps someone who has deployed via the VM on Windows could chime in.

1 Like
vagrant@blog:/vagrant/ansible$ ansible-playbook -i hosts/production deploy.yml --extra-vars="" -vvvv
ERROR: The file hosts/production is marked as executable, but failed to execute correctly. If this is not supposed to be an executable script, correct this with `chmod -x hosts/production`.

I was trying to solve this issue but any of the solution failed for me. And we have an issue still open:

Ah I see, yes that is an issue. I wouldn’t call it a final solution, but you could copy the project to another folder in the VM that is not a shared directory, that should allow you to remove the executable flag and be able to deploy.

The other somewhat clunky workaround someone suggested is mounting the project twice, once with no executable files, and deploy from that.

Hopefully they figure something out in the Ansible project, as mounting folders as a Windows host is somewhat limited, but pretty common.

1 Like

Thanks copy the files and chmod -x ansible/hosts/production helped.
Now im getting a different error. Maybe its because of my DO setup. I didn’t find any specific about what should I set up on DO, so currently I have a simple clean install.

The error message:

vagrant@blog:~/$ ansible-playbook -i hosts/production
 deploy.yml --extra-vars=""

PLAY [Deploy WP site] *********************************************************

GATHERING FACTS ***************************************************************

ok: []

TASK: [deploy | Initialize] ***************************************************

failed: [] => {"failed": true, "parsed": false}
Traceback (most recent call last):
  File "/home/web/.ansible/tmp/ansible-tmp-1434106906.51-187844715946739/deploy_
helper", line 2015, in <module>
  File "/home/web/.ansible/tmp/ansible-tmp-1434106906.51-187844715946739/deploy_
helper", line 382, in main
    changes += deploy_helper.create_path(facts['project_path'])
  File "/home/web/.ansible/tmp/ansible-tmp-1434106906.51-187844715946739/deploy_
helper", line 276, in create_path
  File "/usr/lib/python2.7/", line 150, in makedirs
    makedirs(head, mode)
  File "/usr/lib/python2.7/", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/srv/www'
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: auto-mux: Trying existing master
debug1: mux_client_request_session: master session id: 2
Shared connection to closed.

FATAL: all hosts have already failed -- aborting

PLAY RECAP ********************************************************************

           to retry, use: --limit @/home/vagrant/deploy.retry : ok=1    changed=0    unreachable=0    failed=1

Hey, I was just searching the forums for an error I am receiving from WSL and I found this post.

The error I am getting is:
invalid shell option nameopt: nullglob

This happens when I run:
./bin/ staging

But not when I run:
ansible-playbook deploy.yml -e " env=staging"

Another site I deploy with WSL works fine using both commands and I have checked the files - They are exactly the same.