Trellis: TASK [wordpress-setup : Create database of sites] goes wrong

Created on 22 May 2016  路  10Comments  路  Source: roots/trellis

Bug report

Command:

ansible-playbook server.yml -e env=staging

Log:

TASK [wordpress-setup : Create database of sites] ******************************
System info:
  Ansible 2.0.2.0; Darwin
  Trellis at "Require Ansible 2.0.2 and remove deploy_helper"
---------------------------------------------------
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)): 'dict object'
has no attribute u'theluxuryjournal.com'

The error appears to have been in
'/Users/nick/Development/theluxuryjournal.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: [188.166.160.141]: FAILED! => {"failed": true}
    to retry, use: --limit @server.retry

Please describe your local environment:

Ansible version: ansible 2.0.2.0

OS: 10.10

Vagrant version: Vagrant 1.8.1

Where did the bug happen? Development or remote servers?

Remote server

Please provide a repository or your wordpress_sites config (if possible):

# Documentation: https://roots.io/trellis/docs/remote-server-setup/
# `wordpress_sites` options: https://roots.io/trellis/docs/wordpress-sites
# Define accompanying passwords/secrets in group_vars/staging/vault.yml

wordpress_sites:
  theluxuryjournal.com:
    site_hosts:
      - staging.theluxuryjournal.com
    local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root)
    repo: GIT-REPO-HERE # replace with your Git repo URL
    repo_subtree_path: site # relative path to your Bedrock/WP directory in your repo
    branch: staging
    multisite:
      enabled: false
    ssl:
      enabled: true
      provider: letsencrypt
    cache:
      enabled: false

Most helpful comment

Done! Forgot to add theluxuryjournal.com to the vault config.

All 10 comments

Done! Forgot to add theluxuryjournal.com to the vault config.

thanks @iDuuck exactly my mistake 馃惏

Same. There are a lot of places to remember to put this before provisioning for 10 minutes.

Roots Team: It might be a good idea to test for these values to sync up before running the other provisioners. /shrug

I think that's a good idea. I've actually done this a couple of times since. :man_facepalming:

It would be good, but I do not have enough Ansible knowledge yet to know whether it would be hard to check for example that you forget to replace the example domain. Would be great to suggest in the error message that that might be at. But yeah, would be even greater to check whether there are any leftover example.coms. One thing I can see being an issue though is that I do not always use staging and that you would probably need to check all files loaded example.com data and in my case it would then stop as I did not change anything in the staging folder.

yep, happened to me as well :1st_place_medal:

it happened to me as well and it took too long to fix it too :(

I experienced this as well. Thank you for creating the thread.

I would be willing to submit a patch for this but I'm _brand new_ to Trellis / Bedrock / Sage. So I'll add this to a list of things I want to revisit in coming weeks as I learn my way around a bit more and then try to take a stab at this if no one else has by then.

Had this happen as well, and after checking (and re-checking) that had the domain right everywhere, variables correct, no spelling mistakes, etc, still couldn't get to work. I'm an emacs user, and finally realized that when I first edited wordpress_sites.yml, emacs was creating a wordpress_sites.yml~ temporary file. The presence of this extra file, which didn't have the right domain name/variables in it, was throwing Ansible off, removing it fixed the problem right away. So if any other emacs users are struggling with this particular issue, hopefully this will save you some time and frustration. Not sure if there's a way to make Ansible be able to tell the difference between the two files and always choose the right one, but someday I'll get around to looking into that.

I just added a validation to catch when the vault config hasn't been updated to match wordpress sites: https://github.com/roots/trellis/pull/823

So people shouldn't run into this specific error anymore.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DinisCruz picture DinisCruz  路  7Comments

hintings picture hintings  路  9Comments

reverbsoul picture reverbsoul  路  8Comments

swalkinshaw picture swalkinshaw  路  4Comments

dreamon11 picture dreamon11  路  7Comments