Roots Discourse

"Validate that `letsencrypt_contact_emails` is a list"

Hi guys, following up on this topic, this is still an issue for me.

I upgraded Ansible like suggested to version 2.9.10 and made sure the geerlingguy.ntp version bump was reverted (it was still on version 2.0.0 anyway, but I’m still getting this error when deploying:

TASK [deploy : Is WordPress installed?] ****************************************************************************************************
System info:
Ansible 2.9.10; Darwin
Trellis version (per changelog): "Validate that `letsencrypt_contact_emails` is a list"
---------------------------------------------------
non-zero return code
fatal: [206.189.110.116]: FAILED! => {"changed": true, "cmd": ["wp", "core", "is-installed"], "delta": "0:00:00.427257", "end": "2021-02-15 10:45:28.926875", "rc": 1, "start": "2021-02-15 10:45:28.499618", "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}

Provisioning went fine without any errors?
I enabled SSL and in group_vars/all/main.yml I have added:

letsencrypt_contact_emails:
  - name@mydomain.com

What’s going on here?
Thanks!

Actually the changelog excerpt is printed by ansible, but this isn’t the actual error.
Quite confusing. There must be a different underlying issue. Ansible stops at task Is WordPress installed?.

You’re right. I pulled in the lastest Trellis version 1.8.0 and the error changed into:

TASK [deploy : Is WordPress installed?] ****************************************************************************************************
System info:
  Ansible 2.9.10; Darwin
  Trellis 1.8.0: February 12th, 2021
---------------------------------------------------
non-zero return code
fatal: [206.189.110.116]: FAILED! => {"changed": true, "cmd": ["wp", "core", "is-installed"], "delta": "0:00:00.418137", "end": "2021-02-15 11:05:28.621582", "rc": 1, "start": "2021-02-15 11:05:28.203445", "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}

Which lead me to my finalize-after deploy-hook:

# Hook for updating installed wordpress languages
- name: Is WordPress installed?
  command: wp core is-installed
  args:
    chdir: "{{ deploy_helper.current_path }}"
  register: wordpress_is_installed

- name: Update installed languages for wordpress
  command: wp language core update
  when: wordpress_is_installed is success
  args:
    chdir: "{{ deploy_helper.current_path }}"

- name: Update installed languages for plugins
  command: wp language plugin update --all
  when: wordpress_is_installed is success
  args:
    chdir: "{{ deploy_helper.current_path }}"

I guess this always results in an error on the 1st deploy, because the 2nd one runs fine.
How could I alter this hook so it doesn’t throw an error, but just skips the rest of my hook?

Thanks

I also use similar config to install (and update) languages. On first deploy (without first transfer/installation) the WordPress site core isn’t installed when the language is installed, hence the error. In my finalize-after.yml hook I use the following to prevent issues on first deploy:

- name: Install WP (required for installing languages on non-transferred site)
  command: wp core {{ project.multisite.enabled | default(false) | ternary('multisite-install', 'install') }}
           --allow-root
           --url="{{ site_env.wp_home }}"
           {% if project.multisite.enabled | default(false) %}
           --base="{{ project.multisite.base_path | default('/') }}"
           --subdomains="{{ project.multisite.subdomains | default('false') }}"
           {% endif %}
           --title="{{ project.site_title | default(site) }}"
           --admin_user="{{ project.admin_user | default('admin') }}"
           --admin_password="{{ vault_wordpress_sites[site].admin_password }}"
           --admin_email="{{ project.admin_email }}"
  args:
    chdir: "{{ deploy_helper.current_path }}"
  register: wp_install
  changed_when: "'WordPress is already installed.' not in wp_install.stdout and 'The network already exists.' not in wp_install.stdout"

1 Like

Cool, will try that next time!
Thanks a lot