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 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}.