# Ansible production and development, change hostname

**URL:** <https://forum.ansible.com/t/ansible-production-and-development-change-hostname/22989>\
**Category:** Ansible Project\
**Created:** [November 9, 2016, 5:08pm UTC](https://forum.ansible.com/t/ansible-production-and-development-change-hostname/22989 "2016-11-09T17:08:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Victor\_Caballero](https://avatars.discourse-cdn.com/v4/letter/v/a9adbd/32.png) [@Victor\_Caballero](https://forum.ansible.com/u/Victor_Caballero)\
**Post date:** [November 9, 2016, 5:08pm UTC](https://forum.ansible.com/t/ansible-production-and-development-change-hostname/22989/1 "2016-11-09T17:08:42Z")

</div>

Hello,

I want to use the same playbook for production and development. The playbook is divided in separate role-hosts, let’s say: pubsubservers and mongoservers. I have a hosts file assigning the hostnames:

[mongoservers]  
172.16.2.198

[pubsubservers]  
172.16.2.211

[pubsubandmongo:children]  
mongoservers  
pubsubservers

Imagine that the configuration shown above is for production (production ip adresses). Is there any way to “override” the ip adresses for development (i.e. 127.0.0.1 for both mongoservers and pubsubservers) without changing the hosts file?

Thank you,

---

<div class="post-metadata">

**Author:** ![Dick\_Davies](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Dick\_Davies](https://forum.ansible.com/u/Dick_Davies)\
**Post date:** [November 10, 2016, 12:28am UTC](https://forum.ansible.com/t/ansible-production-and-development-change-hostname/22989/2 "2016-11-10T00:28:02Z")

</div>

Have 2 inventories, one for prod and one for dev. then just call  
Ansible with '-i prod/' or '-i dev/' .

---

<div class="post-metadata">

**Author:** ![Simon\_Wydooghe](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@Simon\_Wydooghe](https://forum.ansible.com/u/Simon_Wydooghe)\
**Post date:** [November 10, 2016, 5:11pm UTC](https://forum.ansible.com/t/ansible-production-and-development-change-hostname/22989/3 "2016-11-10T17:11:31Z")

</div>

As Dick says, you can use multiple inventories. Check out the directory layout in the Ansible Best Practices guide for more info: [http://docs.ansible.com/ansible/playbooks\_best\_practices.html#directory-layout](http://docs.ansible.com/ansible/playbooks_best_practices.html#directory-layout)
