Hello,

The EC2 module's docs show how to create several instances at once using 
the "count" variable, and register the results into another variable 
("ec2").

You can then iterate on the created instances and do stuff (like add them 
to an inventory group) using "with_items: ec2.instances"

However, I can't figure out how to do the following :

1) Have the user provide a "names" list ( { "web1", "web2", "web3" } ). Or 
better yet, a naming prefix ("web"), a count (3) and a start index (1). 
2) Create them using the ec2 module, register results into "ec2" to keep 
precious info like ec2.instances.public_dns_name.
3) Here's the tricky bit : add a route53 DNS entry that CNAMEs together 
each entry in the "names" list with the public_dns_name values in 
"ec2.instances".

I don't believe with_nested will help with 3) and you can't walk through 
the 2 lists together side by side either by having several with_items: 
statements, correct ?

Short of adding the feature to the ec2 module, how would you do that ? 

Can you do something like :
- include add_instance.yml
  with_items: names

and then inside add_instance.yml use the ec2 module with count=1 and create 
the DNS entries from there ?

Thanks !

-- 
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].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to