Hi,
The easiest way imo is to define groups in your inventory. Group the servers that use the same war file togther, and then add a corresponding var file for that group in group_vars. In group vars define a list of the wars on that server.
E.g.: qa01.yml
war_files:
- /something/app1.war
- /something/app2.war
Then in your playbook you can simply just call:
tasks:
- name: rename war files
shell: cp /tmp/staging.war /usr/local/tomcat1/webapps/{{ item }}
with_items: war_files
Depending on which server you are on, it will deploy the specific war files defines in your corresponding group vars