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.
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 temp.org 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.
<128.199.254.221> ESTABLISH CONNECTION FOR USER: root
<128.199.254.221> 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 128.199.254.221 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1432105859.49-73450811581301 && echo $HOME/.ansible/tmp/ansible-tmp-1432105859.49-73450811581301'
fatal: [128.199.254.221] => 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
128.199.254.221 : 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