Provisioning Server Issue with Trellis

I’m trying to run the server playbook to provision my staging server (which is on a DO droplet), and I keep getting this error when I run the ansible-playbook command.

[WARNING]: Failure using method (v2_playbook_on_play_start) in callback plugin
(<ansible.plugins.callback./Users/mero/dimensionsixdesign.com/trellis/lib/trell
is/plugins/callback/vars.CallbackModule object at 0x1121ca910>): Syntax Error
while loading YAML.   mapping values are not allowed in this context  The error
appears to have been in '/Users/mero/dimensionsixdesign.com/trellis/group_vars/
staging/wordpress_sites.yml': line 9, column 20, but may be elsewhere in the
file depending on the exact syntax problem.  The offending line appears to be:
- canonical: d6dstaging.com           redirects:                    ^ here

ERROR! Syntax Error while loading YAML.
  mapping values are not allowed in this context

The error appears to have been in '/Users/mero/dimensionsixdesign.com/trellis/group_vars/staging/wordpress_sites.yml': line 9, column 20, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

      - canonical: d6dstaging.com
          redirects:
                   ^ here

I had commented out the redirects directives so that I can also use the www prefix for the website, but I keep getting the error showed above. Not sure what to do to fix this. Server setup works if I comment those lines back out, but I want both www and non-www.

This is with Trellis 1.0.0. I didn’t see anything in the commits that have come since to suggest that an update to Trellis would fix this issue.

I’m running on a Mac running 10.14.3 with Ansible 2.7.5.

You definitely have some invalid YAML.

I’m not exactly sure what your end goal is, but have you seen our docs on site_hosts? WordPress Sites | Trellis Docs | Roots

I want both www and non-www.

This is a bit ambiguous. Do you want to support both without any redirects? If so, do this:

site_hosts:
  - canonical: d6dstaging.com
  - canonical: www.d6dstaging.com

If you want one host to act as the canonical and redirect the other, then do:

site_hosts:
  - canonical: d6dstaging.com
    redirects:
       - www.d6dstaging.com

OK, I resolved this. Apparently some tabs weren’t set correctly and that was throwing my YAML off.

Also, all I was concerned with with www vs non-www was that you could reach my site either way.

This topic was automatically closed after 42 days. New replies are no longer allowed.