# A few questions regarding staging and production

**URL:** https://discourse.roots.io/t/a-few-questions-regarding-staging-and-production/9645
**Category:** trellis
**Tags:** ansible
**Created:** 2017-05-20T10:05:35Z
**Posts:** 4
**Showing post:** 2 of 4

## Post 2 by @fullyint — 2017-05-20T15:31:40Z

If both staging and production are on the same host/server, you’ll need to use one of the options described here: [Production server provision configures Staging envs if hosts are the same - Bug or Intention?](https://discourse.roots.io/t/production-server-provision-configures-staging-envs-if-hosts-are-the-same-bug-or-intention/6090/2)

Ansible tries to load all `group_vars` for the host it is targeting. If your host uses the same name/alias in multiple environments, Ansible loads `group_vars` for all applicable environments and the load order and resulting precedence for these values would be unpredictable, resulting in messed up variable values.

The PR [roots/trellis#562](https://github.com/roots/trellis/pull/562) had a `validate_one_env_group_only` validation to detect and warn about this problem, but the PR never got traction and needs to be updated. I’ll PR Trellis with a validation for just this issue alone.

* * *

Q. _Is it possible to have both staging and production trellis environments on the same box?_  
A. Yes it’s possible, but not recommended. Would require applying one of [these options](https://discourse.roots.io/t/production-server-provision-configures-staging-envs-if-hosts-are-the-same-bug-or-intention/6090/2).

Q. _During the deploy, does trellis reset the database password both for WordPress and MySql / MariaDB?_  
A. I’m not sure but I don’t think so. Once you’ve sorted out the host issue above, you should be able to get the answer via testing.

Q. _how is_ `vault_mysql_root_password` _from_ `vault.yml` _treated if both environments are on the same machine?_  
A. If both environments are on the same machine, I think this particular password would need to be the same for both environments. But to answer your question, if you don’t apply the fixes mentioned above for multiple envs on same machine, Ansible will load `vault_mysql_root_password` from both environments in a nondeterministic sequence, so you can’t rely on which would take precedence.

Q. _is_ `env()` _trellis’ own function? I am used to_ `getenv()`  
A. roots/bedrock#233: [Use oscarotero/env instead of `getenv`](https://github.com/roots/bedrock/pull/233)

Q. _Is it possible to check the actual values being used by application.php_  
A. SSH into server or VM, navigate to WP, use [`wp eval`](https://developer.wordpress.org/cli/commands/eval/)

```
$ cd /srv/www/example.com/current
$ wp eval 'echo DB_NAME . "\n";'
example_com_production
```

(but maybe that’s not exactly what you wanted)

---

_[View the full topic](https://discourse.roots.io/t/a-few-questions-regarding-staging-and-production/9645)._
