# different config per environnement

**URL:** <https://forum.ansible.com/t/different-config-per-environnement/14281>\
**Category:** Ansible Project\
**Created:** [January 6, 2014, 10:01pm UTC](https://forum.ansible.com/t/different-config-per-environnement/14281 "2014-01-06T22:01:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Tourel](https://avatars.discourse-cdn.com/v4/letter/d/8c91f0/32.png) [@David\_Tourel](https://forum.ansible.com/u/David_Tourel)\
**Post date:** [January 6, 2014, 10:01pm UTC](https://forum.ansible.com/t/different-config-per-environnement/14281/1 "2014-01-06T22:01:53Z")

</div>

Hi,

I’m very new to ansible, my question seems  
I’ve created a task that simply deploy phpmyadmin on a given webserver. The selected webserver was targeted by an inventory file. I’ve an inventory per environment, dev, stage, prod.  
my directory layout follow the best practices ([http://docs.ansible.com/playbooks\_best\_practices.html](http://docs.ansible.com/playbooks_best_practices.html))

# prod inventory

[phpmyadmin]  
[admin.myproject.com](http://admin.myproject.com)

and

# dev inventory

[phpmyadmin]  
localhost

That works well !

Now I want to configure phpmyadmin differently according to the environment, trought j2 templates, for example to disable login form on dev environment. But actually the task run the same on both.

- name: Web | Configuration for Dev Environment  
action: template src=config.inc.php.j2 dest=/etc/phpmyadmin/config.inc.php

So, how to differentiate this task for each of my two environment ?

Regards,  
David

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [January 6, 2014, 10:08pm UTC](https://forum.ansible.com/t/different-config-per-environnement/14281/2 "2014-01-06T22:08:26Z")

</div>

i would do this in the template,either using groups or a group var

this is using a group named dev:  
{% if ‘dev’ in group\_names %}  
stuff that disables login  
{% endif %}  
… rest of config

---

<div class="post-metadata">

**Author:** ![David\_Tourel](https://avatars.discourse-cdn.com/v4/letter/d/8c91f0/32.png) [@David\_Tourel](https://forum.ansible.com/u/David_Tourel)\
**Post date:** [January 7, 2014, 4:39pm UTC](https://forum.ansible.com/t/different-config-per-environnement/14281/3 "2014-01-07T16:39:29Z")

</div>

it’s works well, thanks

For others users that answers the same question :  
I’ve just added a “dev” group to my inventory, containing my localhost. so with Brian’s tip, you can test if “dev” group exists during the play.

# dev inventory

[phpmyadmin]  
localhost

[dev]  
localhost
