Trying to deploy - FATAL: all hosts have already failed -- aborting

I setup a server on DO, added the keys and everything.

I’m trying to deploy with ansible-playbook -i hosts/staging server.yml -vvvv
It connects, it seems that it does the apt-get update and all, but fails after that.

You can check the log here:

Any ideas on what could be the problem?

Never seen that error before but after brief searching it seems like a Jinja templating error.

Does it happen repeatedly?

I am still new to bedrock-ansible.

Here are some of my configs:

It doesn’t pass the fail2ban settings. But also when I remove, it gives an error in the next stepp.

Not sure this matters for the error or if you just edited out your real host, but under site_hosts it should be a hostname like and not just temp.

I just tried again, new server, new ansible-bedrock setup.
Let’s say I want to deploy a blank Wordpress with it, I don’t know why it’s giving an error when it tries to run the tasks.

it’s a ubuntu 14.04 blank installation.

<> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/daniel/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1432105859.49-73450811581301 && echo $HOME/.ansible/tmp/ansible-tmp-1432105859.49-73450811581301'
fatal: [] => Failed to template o2M4cKQVn.dCLC!G!%N_~_%OGt&SC[X3!08{%b1Q 5%ikS?!%[va)Q>FL%M,165N: template error while templating string: Encountered unknown tag 'b1Q'.

FATAL: all hosts have already failed -- aborting

PLAY RECAP ********************************************************************
           to retry, use: --limit @/Users/daniel/server.retry            : ok=9    changed=7    unreachable=1    failed=0```

This happened when you have the ‘{%’ character in your salt string which Jinja treated as a statement delimiter. Same as having a space character or or other delimiters. Simply by replacing the character will prevent the error.

Quite a simple issue but did cause me big headache as a beginner I am.
I couldn’t find any guide on it so hope this help someone.


@eeebb_ interesting, thanks for posting this. Were your salt strings surrounded by quotes though? By default we have them as "generateme" so that the values remain in quotes which should avoid those templating issues but I should test that.

Enclosing the strings with single or double quotes show the same error in my case. Although, I am running ansible under cygwin, perhaps that somehow cause such issue

Looks like someone else ran into the same problem:

@eeebb_ thanks again for figuring this out. For now I’ve added a note to the files about this: