You could use a `local_action 
<http://docs.ansible.com/playbooks_delegation.html>` to shell out to some 
command that generates IDs [1]. This technique is often used to generate 
passwords in Ansible plays [2,3]. You could generate hostnames in the same 
way by simply restricting the alphabet of generated strings to something 
like `[0-9]{3}`.

[1] https://groups.google.com/forum/#!topic/ansible-project/xthTljaVeEI
[2] https://groups.google.com/forum/#!topic/ansible-project/8zLKXnwCF9s
[3] https://gist.github.com/eosrei/5191334

On Tuesday, May 12, 2015 at 2:37:43 PM UTC-7, Theodore wrote:
>
> I need to generate hostnames for a concurrent service that contain 
> sequences. So I create 5 AWS instances and I want to call them h001, h002, 
> h003, h004, h005.
>
> I create the instances concurrently and then use dynamic inventory to 
> drive subsequent plays. How do I implement a sequence number in Ansible so 
> that I can name these hosts in this way?
>

-- 
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/122babe7-0adf-4eb8-a1d8-97e9dd14fc1b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to