Dynamic playbook

Hi,
Is it possible to create dynamic playbook in ansible based on inventory?

My requirement is:

  • maintain different inventory files for different applications, which contains sequence/flow of tasks that need to execute
  • Using generic playbook(s) i should be able to create playbook for a particular application

For example:
→ App-1’s playbook might execute tasks in below sequence:
Task-1
Task-2
Task-3



Task-n

→ App-2’s playbook might execute the same tasks in different sequence:
Task-3
Task-1
Task-n


Task-2

I dont want to maintain separate playbook for each application.

Let me know if you need any other info regarding this.

Thanks