Okay, thanks for this info. I worked around it by creating a group_var file for each environment and import it into the playbook using vars_file. It works good enough for me.
Am Montag, 28. Juli 2014 13:58:22 UTC+2 schrieb Christo Buschek: > > 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 > -- *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/2007bca2-72ff-4cda-b3fc-4528a222f2d6%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
