Try changing that second line of wordpress_sites
from project-name.com:
to staging-project-name.com:
. Note other implementation details and discussion…
My recommendation would be to use a different server for each environment and the issues you’ve mentioned should resolve. You’ll find various discussion in this Roots discourse of whether to put staging and production on the same server vs. separate servers. In my opinion the intention of Trellis and best practice generally is separate servers.
hostname alias in hosts file. If you must use a single server for both staging and production, use an alias in your hosts file (see option 1). Discussion in that thread will demonstrate how doing this will clarify for Ansible which vars are for staging vs. for production…
site key. If you must use a single server for both staging and production, use a different “site key” in your staging wordpress_sites
dictionary:
wordpress_sites:
- nico.onl:
+ stage.nico.onl:
site_hosts:
...
Trellis uses this site key in some directory paths and file names. If on a single server you duplicate this key for different sites or envs, the duplicate will overwrite the original…
Try making the change above, then run
# fix up staging
ansible-playbook server.yml -e env=staging
# fix up production
ansible-playbook server.yml -e env=production