LetsEncrypt Provision Issue

Hi I’m trying to provision a remote server using the latest version of Trellis, however it’s failing on this:

TASK [letsencrypt : Create needed Nginx confs for challenges] ************************************************************
System info:
  Ansible 2.3.0.0; Darwin
  Trellis at "Add Vagrant config"
---------------------------------------------------
The conditional check 'missinghosts | count' failed. The error was: {{
site_hosts | difference((current_hosts.results | selectattr('item.key',
'equalto', item.key) | selectattr('stdout_lines', 'defined') |
sum(attribute='stdout_lines', start=[]) | map('trim') | list | join('
')).split(' ')) }}: {{ site_hosts_canonical | union(site_hosts_redirects) }}:
{{ item.value.site_hosts | selectattr('redirects', 'defined') |
sum(attribute='redirects', start=[]) | list }}: Unexpected templating type
error occurred on ({{ item.value.site_hosts | selectattr('redirects',
'defined') | sum(attribute='redirects', start=[]) | list }}): can only
concatenate list (not "unicode") to list

The error appears to have been in
'/Users/name/Sites/wp/trellis/roles/letsencrypt/tasks/nginx.yml': line
16, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


- name: Create needed Nginx confs for challenges
  ^ here

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

Does anybody know why this would be happening?

Thanks

Rob

I’m gonna bet that the site keys (names) in wordpress_sites.yml and vault.yml don’t match. It’s definitely the first thing to check!

1 Like

@humet The error can only concatenate list (not "unicode") to list related to redirects made me think that perhaps you’ve formatted your site_hosts with a redirects value that is a string (unicode in Ansible) instead of as a list. I can reproduce the error above if I use the following format:

  wordpress_sites: 
    example.com:
      site_hosts:
        - canonical: example.com
          redirects: www.example.com

The error goes away if I format redirects as a list, like the default:

  wordpress_sites: 
    example.com:
      site_hosts:
        - canonical: example.com
-         redirects: www.example.com
+         redirects:
+           - www.example.com
+           - someotherdomain.com

The YAML for site_hosts can be a bit complex, if that kind of thing is unfamiliar. This final section of this attempted explanation of YAML for site_hosts may help.

2 Likes

Thanks @fullyint this worked perfectly.

1 Like