Groups at the same level of depth will definitely override each other.

What you need to do is consider using role variables, or vars_files, or
"vars", etc, or name the variable something like "app2_port"

There are some good tips on http://docs.ansible.com/playbooks_variables.html





On Mon, Jul 28, 2014 at 7:58 AM, Christo Buschek <
[email protected]> wrote:

> I'm fairly new to Ansible, so maybe what I'm trying to do is bad anyway.
>
> I use ansible to deploy all of our web applications. I use a special
> deploy playbook for every app. Now every app can be deployed to staging or
> production. For each of those environments I use a separate inventory such
> as `envs/staging'. Inside the inventory I use one group for every app and
> set certain environment specific variables in this way"
>
> [app1]
> app.example.com
> [app1:vars]
> app-port=3000
> app_domain=sub1.example.com
>
>
> [app2]
> app.example.com
> [app2:vars]
> app-port=3001
> app_domain=sub2.example.com
>
> I would deploy an app like that: ansible-playbook -i envs/staging
> deploys/app2.yml -K
>
> Now this doesn't work unfortunately. In my example it always takes the
> configuration of app1, even if I deploy app2. In my playbook for app2 I do
> have the following line: hosts: app2.
>
> So my question would be, why is the playbook for app2 taking configuration
> options defined for app1? Do I use inventory variables wrong? Do
> otherpeople use ansible to deploy apps and how do they keep the
> environments separated?
>
>
> *UnlockYourBrain GmbH*
> c/o Smart Mobile Factory GmbH
>
> Französische Str. 24
>
> 10117 Berlin
>
> Germany
>
>
> *www.unlockyourbrain.com <http://www.unlockyourbrain.com/>*
>
> Download at *Google Play
> <https://play.google.com/store/apps/details?id=co.unlockyourbrain&referrer=utm_source%3DMA%26utm_medium%3Demail%20footer%26utm_term%3Dgen%26utm_content%3Dgen%26utm_campaign%3Dgen>*
>
> Like us on *Facebook*
>
>
> Geschäftsführer: Felix Nienstädt, Simon Smend
>
> Unternehmenssitz: Berlin
>
> Eingetragen am Handelsgericht Charlottenburg unter HRB 149905 B
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/c9a37542-c877-4b0d-884a-2a3aed53a2da%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/c9a37542-c877-4b0d-884a-2a3aed53a2da%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgzj39PM5vZaM-8YL%3D3_B_%3D0ttLR8hzntwAja4sCoOy69A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to