[ansible-project] Re: Dynamic deployment to AWS w/ Groups

2015-10-23 Thread Arbab Nazar
I thinks this setup will help you. |-- production | |-- group_vars | | `-- server.yml | `-- inventory |-- site.yml |-- staging | |-- group_vars | | `-- server.yml | `-- inventory |-- myrole | |-- handlers | | `-- main.yml | |-- tasks | | |-- main.yml | |-- templates

[ansible-project] Re: Dynamic deployment to AWS w/ Groups

2015-10-24 Thread Rob Wilkerson
Thanks, Arbab - This makes sense, except for the inventory file in each "group" directory. My understanding of the documentation, for what little my understanding is worth at this point, is that an inventory file is somewhat discouraged. Are you saying quite literally that my production/invento

[ansible-project] Re: Dynamic deployment to AWS w/ Groups

2015-10-24 Thread Igor Cicimov
You don't need any groups at all I would say, just use the --extra-vars parameter when launching the playbook to tell it what kind of instances you want to launch. For example: -- extra-vars '{"my_env":"prod"}' then in the playbook you evaluate this variable and set some facts accordingly:

[ansible-project] Re: Dynamic deployment to AWS w/ Groups

2015-10-24 Thread Arbab Nazar
Excellent method but you cannot use dynamic inventory group Ansible creates based on Tags: - hosts: tag_Env_prod ... - hosts: tag_Env_dev ... - hosts: tag_Env_stage ... in the same playbook because it will give the create that group doesn't exist or no host inside the group instead you can u

[ansible-project] Re: Dynamic deployment to AWS w/ Groups

2015-10-24 Thread Igor Cicimov
Arbib is right, you will have to add them to a new group and use that in the next play in the same playbook. I went overboard trying to simplify so it does not confuse the beginner folk that might read this post. Anyway, the point is: in AWS the tags are very powerful in terms of automation so

[ansible-project] Re: Dynamic deployment to AWS w/ Groups

2015-10-25 Thread Rob Wilkerson
I've been running this over in my head and I think I'm more confused than ever. I don't really care whether I specifically use dynamic inventory or any other specific technique. I care that my script is idempotent, reasonably simple to execute for any developer and somewhat consistent with Ansi

[ansible-project] Re: Dynamic deployment to AWS w/ Groups

2015-10-25 Thread Igor Cicimov
Well as I expected this might be little bit confusing to a beginner. So basically the answer to your question was: tag the instances you create based on the environment you are creating them in and then use that tag for the configuration task(s). Which means you need to base the exact_count on

[ansible-project] Re: Dynamic deployment to AWS w/ Groups

2015-10-26 Thread Rob Wilkerson
Thanks, Igor. This has been great. It sounds like you're saying I can't/shouldn't use an inventory file at all, but explicitly pass an extra var for the environment. Rather than dropping conditionals everywhere I need env-specific values, is there any way to get Ansible to use that env value t

[ansible-project] Re: Dynamic deployment to AWS w/ Groups

2015-10-26 Thread Igor Cicimov
Hey Rob, Well you definitely need a dynamic inventory which in case of AWS is provided by the *ec2.py* script. I guess you have already read on how to setup this, some helpful links below: http://docs.ansible.com/ansible/intro_dynamic_inventory.html#example-aws-ec2-external-inventory-script htt

[ansible-project] Re: Dynamic deployment to AWS w/ Groups

2015-10-27 Thread Rob Wilkerson
Thanks so much, Igor. Tons of great information in there and I really appreciate the jump start. It was feeling a little bit like a paralysis of choice thing for a while there. On Monday, October 26, 2015 at 8:11:38 PM UTC-4, Igor Cicimov wrote: > > Hey Rob, > > Well you definitely need a dynami

Re: [ansible-project] Re: Dynamic deployment to AWS w/ Groups

2015-10-24 Thread Arbab Nazar
Rob, how you are creating the EC2 instances? because EC2 module run as local action. Can you please share your role/playbook so that I'll look into this and try to explain the things in better way. Thanks, On Sat, Oct 24, 2015 at 5:40 PM, Rob Wilkerson wrote: > Thanks, Arbab - > > This makes sen

Re: [ansible-project] Re: Dynamic deployment to AWS w/ Groups

2015-10-24 Thread Rob Wilkerson
So I may not have a great answer for that. :-) I'm only JUST getting started on this task and with Ansible itself. At the moment I have a deploy.yml playbook file from which I'd like to execute 2 roles: launch & configure. The launch will, of course, launch n instances for any given environmen