Bash error during Trellis server provisioning

I new to roots and server configuration so forgive me if I seem somewhat clueless.
I’ve been following along the docs and when I go to provision my server with

ansible-playbook server.yml -e env=staging

I receive this error. (My server ip has been replaced with xx.xxx.xxx.xxx, and my domain myurl.com, where example.com appears in the error, it also appears in my actual error).

TASK [wordpress-setup : Generate self-signed certificates] *********************
skipping: [xx.xxx.xxx.xxx] => (item=myurl.com)
---------------------------------------------------
non-zero return code
/bin/bash: -c: line 0: unexpected EOF while looking for matching `)'
/bin/bash: -c: line 10: syntax error: unexpected end of file
failed: [xx.xxx.xxx.xxx] (item=no_default) => {"changed": true, "cmd": "openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 -sha256 -extensions req_ext -config <( cat <<' EOF'\n[req]\nprompt = no\ndistinguished_name = req_dn\n[req_dn]\ncommonName = example.com\n[req_ext]\nsubjectAltName = DNS:example.com\nEOF\n) -keyout no_default.key -out no_default.cert", "delta": "0:00:00.003399", "end": "2018-12-20 02:08:21.527204", "item": {"key": "no_default", "value": {"multisite": {}, "site_hosts": [{"canonical": "example.com"}], "ssl": {"enabled": true, "provider": "self-signed"}}}, "rc": 1, "start": "2018-12-20 02:08:21.523805", "stderr_lines": ["/bin/bash: -c: line 0: unexpected EOF while looking for matching `)'", "/bin/bash: -c: line 10: syntax error: unexpected end of file"], "stdout": "", "stdout_lines": []}

Any help or ideas would be appreciated.

:thinking: never seen this before.

However, if example.com is appearing then you haven’t completely configured your wordpress_sites yet (or maybe not the proper one).

Are you editing group_vars/staging/wordpress_sites.yml? You’ll want to set your site_hosts in there according to https://roots.io/trellis/docs/wordpress-sites/#normal-settings.

Also, if you have a real domain/host with DNS set up, I’d suggest using the letsencrypt SSL provider rather than self-signed. That’s really only meant for development.

You can see the docs at https://roots.io/trellis/docs/ssl/#lets-encrypt

Are you editing group_vars/staging/wordpress_sites.yml?

Yes I’ve configured it accordingly and there is no instance of example.com in the file.

I’d suggest using the letsencrypt SSL provider rather than self-signed.

My /staging/wordpress_sites.yml is set to use letsencrypt, I don’t know why it’s attempting to self-sign?

In fact, here are the results of a grep in my trellis directory. (Most or all of the instances occur in comments).

$ grep -lr "example.com" ~/Sites/myurl.com/trellis -s

myurl.com/trellis/group_vars/development/vault.yml
myurl.com/trellis/group_vars/all/mail.yml
myurl.com/trellis/group_vars/all/main.yml
myurl.com/trellis/bin/deploy.sh
myurl.com/trellis/CHANGELOG.md
myurl.com/trellis/roles/letsencrypt/library/test_challenges.py
myurl.com/trellis/roles/ssmtp/defaults/main.yml
myurl.com/trellis/roles/sshd/README.md
myurl.com/trellis/roles/wordpress-setup/defaults/main.yml
myurl.com/trellis/roles/common/templates/site_hosts.j2
myurl.com/trellis/roles/nginx/templates/h5bp/directive-only/cross-domain-insecure.conf
myurl.com/trellis/README.md
myurl.com/trellis/hosts/development
myurl.com/trellis/vendor/roles/mailhog/tests/message
myurl.com/trellis/vendor/roles/mailhog/.travis.yml

and another searching for self-signed

$ grep -lr "self-signed" ~/Sites/myurl.com/trellis -s

myurl.com/trellis/group_vars/development/wordpress_sites.yml
myurl.com/trellis/roles/wordpress-setup/tasks/self-signed-certificate.yml
myurl.com/trellis/roles/wordpress-setup/tasks/main.yml
myurl.com/trellis/roles/wordpress-setup/defaults/main.yml
myurl.com/trellis/roles/wordpress-setup/templates/wordpress-site.conf.j2
1 Like

Thank you for the great debugging and details by the way :smile:

This sounds like it could be an issue with your hosts files in Trellis. Do you happen to have the same host/IP in multiple hosts files?

If so, here’s a great explanation/solution:

No I have the IPs for seperate DO droplets for my staging and productions hosts file.

My bad. I was running Ansible 2.8.0.dev0 . Downgrading to 2.7.5 solved my problem. Thanks for your help.

3 Likes

Did you by chance see a warning about the max tested Ansible version? It’s fine if you missed it (or ignored it :smile:), but just wondering if its working properly.

Yeah the warning was working, just missed it. :relieved:

1 Like

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