'letsencrypt_enabled' failed - trellis error

when deploying to my staging environment with this command -

ansible-playbook server.yml -e env=staging -vvv

I get the error message (see below).

The conditional check ‘letsencrypt_enabled’ failed. The error was: error
while evaluating conditional (letsencrypt_enabled): [{% for name, site in
wordpress_sites.iteritems() if site.ssl.enabled and site.ssl.provider |
default(‘manual’) == ‘letsencrypt’ %}’{{ name }}’,{% endfor %}]: {u’lc-
dev1.co.uk’: {u’repo_subtree_path’: u’site’, u’multisite’: {u’enabled’:
False}, u’env’: {u’wp_home’: u"{{ item.value.ssl.enabled | default(false) |
ternary(‘https’, ‘http’) }}://${HTTP_HOST}", u’wp_siteurl’:
u’${WP_HOME}/wp’}, u’cache’: {u’enabled’: False}, u’repo’: u’git@github.com
:sb-lc/lc-blogs-trellis.git’, u’ssl’: {u’enabled’: True, u’provider’:
u’letsencrypt’}, u’local_path’: u’…/site’, u’branch’: u’master’,
u’site_hosts’: [u’lc-dev1.co.uk’], u’www_redirect’: True}}: ‘dict object’ has
no attribute 'value’
fatal: [lc-dev1.co.uk]: FAILED! => {“failed”: true}

my group_vars/staging/wordpress_sites.yml -

wordpress_sites:
lc-dev1.co.uk:
site_hosts:
- lc-dev1.co.uk
#www_redirect: true
local_path: …/site # path targeting local Bedrock site directory (relative to Ansible root)
repo: git@github.com:sb-lc/lc-blogs-trellis.git # replace with your Git repo URL
repo_subtree_path: site # relative path to your Bedrock/WP directory in your repo
branch: master
multisite:
enabled: false
ssl:
enabled: true
provider: letsencrypt
cache:
enabled: false
env:
wp_home: "{{ item.value.ssl.enabled | default(false) | ternary(‘https’, ‘http’) }}://${HTTP_HOST}"
wp_siteurl: “${WP_HOME}/wp”

Which version of Ansible and Vagrant are you using?

ansible 2.1.0.0

Vagrant 1.8.1

Please make sure your dependency versions match the requirements: https://github.com/roots/trellis#requirements

yes, they match

virtualbox - 5.0.22

ansible 2.1.0.0

Vagrant 1.8.1

the requirements are :slight_smile:

Ansible 2.0.2
Virtualbox >= 4.3.10
Vagrant <= 1.8.1

@jajouka It appears that your wordpress_sites explicitly defines the env vars wp_home and wp_siteurl with the same values as the defaults used for provisioning. With these defined, they will not be replaced during the deploy by the slightly different defaults used for deploying. Your definitions use variables such as item.value.ssl.enabled whereas the deploy process needs the form to be project.ssl.enabled and thus it is failing with the error no attribute 'value'.

Given that you’re using the defaults, you could just omit the definition of any env vars from your wordpress_sites and let the defaults function on their own. The provision vs. deploy processes will select the appropriate defaults without your intervention.

If you’d prefer to explicitly define the env vars, try doing so without variables, but with hardcoded values:
wp_home: https://lc-dev1.co.uk