Refactore create environment in HA deployment modes