Yep, that's exactly what we tell folks to do. You can also use a conditional meta: refresh_inventory with the same technique (and map the tag-based groups into "human-readable" group names in the static inventory) when the task returns new hosts created instead of the add_host. That way you don't have to worry about dynamically mapping groups in your playbook- you can keep it all abstracted in the inventory. Functionally about the same...
-Matt On Monday, November 14, 2016 at 2:40:27 AM UTC-8, J Hawkesworth wrote: > > I don't have any examples but I think you could have a static > group_vars/windows.yml file that sets the windows connection settings and > then add_host the windows instance(s) to your pre-existing static windows > group. > > Hope this helps, > > Jon > > On Monday, November 14, 2016 at 1:30:36 AM UTC, [email protected] wrote: >> >> Can any one suggest me with best way for using dynamic inventory for ec2 >> windows. >> Usually for linux ec2.....i have a play which goes like >> >> 1) creates a ec2 instance ---first play >> 2) refresh dynamic inventory ---2nd play >> 3) connect to linux instance --3rd play >> >> but when i do the same thing with windows ec2...ansible is trying to ssh >> into the windows host and failing.. >> >> can any one post a sample play that i can use to create ec2 >> windows,,,refresh dynamic inventory and connect and configure the windows >> in the same playbook without having to create a static inventory for >> windows. >> > -- 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/3b7168ab-78d9-4036-b745-f00bb63b15d7%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
