My first thought is how do you have your inventory in tower? Does it match the same exact layout as your inventory on the command line?
As in server1 is the first entry, server2 the second, etc…?
But generally speaking, since inventories may not always be perfectly matched, a better solution would be to do some python/jinja2 logic in your Template to scan the inventory provided and generate the server properties.
Tower saves the inventory in the database that it gets from the ansible-inventory command. To the best of my memory, ansible-inventory does an ordered JSON dump. We later take it back out of the database for the job run (at which point I really don’t think the JSON dump is ordered), the ordering is lost at some point along the line. Exactly where, and if it’s one step or multiple steps, I don’t know. We would need to maintain an order field in some shape or form to actually support it, and that’s pretty non-trivial.