.ENV not updating on production

Also be sure your hosts/production and hosts/staging don’t have the same IP or hostname, otherwise Ansible might be using your group_vars/staging such that changes to group_vars/production have no effect. That issue is described here:

If the above applies, it’s just an issue of understanding how Ansible applies/uses host patterns. If you want to think about it a lot, this is a helpful note explaining the issue:

You CAN use the groups as a way to target hosts but that does not mean the other ‘host properties’ disappear. I am in the ‘males’ group and in the ‘programmers’ group, just because you ‘select me’ as a programmer I do not stop being male. ref

In the Trellis case, if a host is in both staging and production, targeting it with -e env=production doesn’t make the host no longer also in staging. Ansible will load both your production and staging versions of the vault_wordpress_sites variable, and potentially in a sequence that leaves the staging version in effect.

2 Likes