Server.yml failing at wordpress-setup : Create database of sites after upgrade to 0.9.8

Hi there!

I just upgraded my server to xenial and trellis to 0.9.8. on provisioning the server, I get this error:

TASK [wordpress-setup : Create database of sites] ******************************
System info:
  Ansible 2.1.2.0; Darwin
  Trellis at "Enable per-site setup for permalink structure"
---------------------------------------------------
The conditional check 'site_uses_local_db and item.value.db_create |
default(True)' failed. The error was: {{ site_env.db_host == 'localhost' }}:
{{ wordpress_env_defaults | combine(item.value.env | default({}),
vault_wordpress_sites[item.key].env) }}: {u'rundumhamburg.com': {u'env':
{u'auth_salt':
u'}LYJeYt;qL/&Azkl.C;gRp8##.KIS,5Ajz%A{!R*+kpBI*xCOUORJc;1*K9AA_,q',
u'nonce_salt':
u'eUy(ENZ&jC?@r$^sUqRmX=HZ3_1s;C/T]}OxGf.9D9kUk(Yi2,*/#>h_*<+H}(84',
u'auth_key':
u'4N/nA,xw^C4w6=U2k8Y1sno;c7M)jW=g^7C!XIph>D=kV.=eQtRF@n^L7h&S2<F8',
u'db_password': u'blablablablamyPasswordhere', u'secure_auth_key':
u'H3WX}dec_f5xViNcE(Zg9{mQ!_u,#^#-tOt#,Te.2u|nVq1}Lb@0*[v::n;I7)D=',
u'nonce_key':
u'Jh|XL3V@cS!B&|mB(8DwkaVT7&1Bb1@f^_uU@4{iIRv5n}?=3+{hz=P:2Uze]6<M',
u'logged_in_salt': u'Xh$a_.<xZPH6yVH8^.;7c0!%_%$|qA;_!I.LBFw)cjM]%XuV-
sCmnA8T!o*p<#jN', u'logged_in_key':
u'BO(>Mt<yHT6ax)d^gf[V>#K>ZBW9p0^DdlE78JN<Q5GPoU0|{{FT!dJpv^hlNENu',
u'secure_auth_salt':
u'C]xr!+9:gyoEhAR}*5#rlnsyNc46%bdUPOqNTzkOc9m={(Flywx$98e6pFLO?r<'}}}:
template error while templating string: unexpected char u'!' at 52. String:
BO(>Mt<yHT6ax)d^gf[V>#K>ZBW9p0^DdlE78JN<Q5GPoU0|{{FT!dJpv^hlNENu

The error appears to have been in '/Users/Allmighty/Sites/ruh/trellis/roles
/wordpress-setup/tasks/database.yml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

---
- name: Create database of sites
  ^ here

fatal: [37.17.229.126]: FAILED! => {"failed": true}

I triple checked everything and keep and all files should be working.

I also look at this but it seems it applies to an old version of trellis since the file is different from the one at 0.9.8.

The error implies that an unexpected char “!” on my salts is causing the error. I tried replacing those chars from my salts but didn’t work. Any Ideas?

Any help more than appreciated!

Bruno

1 Like

Ok I got it working. You really have to generate the salts on the roots generator.
The problem was in the salts I generated somewhere else and somehow broke the templating.
I wonder what are the parameters to generate the salts by myself. Any Hints?

Thanks for reporting this.

I believe the problem was that your original value for logged_in_salt contained {{ which is a jinja templating delimiter. So, where the parser saw {{FT!dJpv^hlNENu it was expecting {{var_name}} but the ! is not allowed in variable names, so there was a templating error. Although the roots salts generator is awesome, other generators should work fine too, except in the rare case that the values produced include delimiters like {{.

Trellis tries to prevent interpretation of delimiters like {{ in salts and keys, e.g., as in roots/trellis#615. However, Ansible >= 2.1.1.0 introduced an internal API change (discussion at Ansible) causing get_group_vars to return nothing, causing Trellis to not take any action on the matter. In other words, I can’t reproduce your issue on Ansible 2.0.2.0, but I can reproduce on Ansible >= 2.1.1.0.

Thank you very much @fullyint! :wink:

I am getting the same error and have listed it on a seperate ticket so to speak as part of my provisioning a remote server droplet.

Mine isn’t failing at the salts but here which is a bit weird…

The conditional check ‘site_uses_local_db and item.value.db_create |
default(True)’ failed. The error was: error while evaluating conditional
(site_uses_local_db and item.value.db_create | default(True)): {{
site_env.db_host == ‘localhost’ }}: {{ wordpress_env_defaults |
combine(item.value.env | default({}), vault_wordpress_sites[item.key].env)
}}: ‘dict object’ has no attribute u’xxx.xx.xx.xxx’

The error appears to have been in ‘/Users/xxxxxxx/Sites/CGW/trellis/roles
/wordpress-setup/tasks/database.yml’: line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


  • name: Create database of sites
    ^ here

fatal: [xxx.xx.xx.xxx]: FAILED! => {“failed”: true}

I’m experiencing the same issue.

`TASK [wordpress-setup : Create database of sites] ******************************
System info:
Ansible 2.2.1.0; Darwin
Trellis at “Check Ansible version before Ansible validates task attributes”

The conditional check ‘site_uses_local_db and item.value.db_create |
default(True)’ failed. The error was: error while evaluating conditional
(site_uses_local_db and item.value.db_create | default(True)): {{
site_env.db_host == ‘localhost’ }}: {{ wordpress_env_defaults |
combine(item.value.env | default({}), vault_wordpress_sites[item.key].env)
}}: ‘dict object’ has no attribute u’kangapestcontrol.com’

The error appears to have been in
’/Users/spencerhill/Sites/kangapestcontrol.com/trellis/roles/wordpress-
setup/tasks/database.yml’: line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


  • name: Create database of sites
    ^ here

fatal: [staging.kangapestcontrol.com]: FAILED! => {“failed”: true}`

Looks like you missed updating vault.yml with your site name? See WordPress Sites | Trellis Docs | Roots

1 Like

Initially I did not set the site name (just oversight on my part) but I corrected that and reran the script and got the same issue. But I slept on it and re-ran it today and it completed without errors. So it must have been a user error this last time.

Thank you!

1 Like