Roots Discourse

AnsibleUndefinedVariable: 'generate_cert_ids' is undefined

I am provisioning a staging server for multisite and have never encountered this issue before. Running the provision with -vvvv does not reveal anything useful to me. I have tried using a fresh server, etc. but I cant seem to figure out whats causing this error.

AnsibleUndefinedVariable: 'generate_cert_ids' is undefined

SSL is set to false but I notice the provision chokes at

TASK [wordpress-setup : Create Nginx conf for challenges location] *************
ok: [ip-address]

TASK [wordpress-setup : Create WordPress configuration for Nginx] **************

Also searching my folders for generate_cert_ids shows its in the LetsEncrypt folders. Any suggestions?

Is this a fresh clone of Trellis? Have you ever updated or attempted to merge an update with your copy of Trellis?

I ran into a Lets Encrypt issue the other day by recklessly copying my group_vars into a newer version of Trellis without looking at what’s changed in those files recently.

1 Like

Quick fix

I suspect you’re using Ansible and that the problem will no longer occur if you update to or higher.

ansible --version
pip install --upgrade ansible

If for some reason you can’t upgrade Ansible, try running the playbook with the wordpress tag. That tag should cause a necessary additional task to run, enabling the wordpress role that failed before to succeed this time:

ansible-playbook server.yml -e env=<environment> --tags wordpress


Trellis will need to bump the required Ansible version (already in the works) or create a specific fix for

At first glance, I think the older vs newer versions of Ansible differ in how a role’s included task files are handled when a role is skipped altogether (e.g., the letsencrypt role in this case). I believe older Ansible doesn’t even see the included tasks, so any variables registered during those tasks are left undefined (you got the undefined error), whereas newer Ansible sees the tasks and defines the registered variables with “skipped” values.

I regret that I must have neglected to test the specific scenario (SSL false, Ansible, and no --tags) as I prepared roots/trellis#630 which introduced generate_cert_ids.


Thanks guys I’ll try that and let you know what happens.

This is a fresh clone.

Just ran into this too. The suggested workaround didn’t work, so I had to delete lines 51-75 of wordpress-site.conf.j2 to get it working.

1 Like

Tried this and it didnt work unfortunately

Ended up doing this.

By removing lines 51-75 from my config I was able to get the server provisioned without error. However, I am now getting a huge error involving a WordPress database error. I have already tried reprovisioning everything, etc.

WordPress database error Table 'sitename_staging.wp_blogs' doesn't exist... and it goes on like that for about 30 lines. Any advice?

Deploy fails on TASK [deploy : WordPress Installed?]

@louisnovick @Jon
Thanks for reporting the original problem and that it persists despite updating Ansible.
I’d be curious to know what version of python you are running:

python --version
ansible --version

I’d also be curious to know whether the proposed fix in roots/trellis#753 resolves the issue for you. Of course, you would need to add back in lines 51-75 of wordpress-site.conf.j2 for the test to be meaningful.

I think this is a separate issue. You may need to SSH into the remote and manually run
wp core multisite-install <options>

If you have more trouble with that particular error message, search for threads related to multisite. Because it’s a new topic, start a new thread if you still want assistance.

Thanks for responding. Python 2.7.13. ansible

1 Like