Branching/conditional statements to install different editions and versions of MS SQL Server

Hello,

I have created a role to install MSSQL for different versions (2014,2016,2017,2019) and its working fine for all the versions.

For installing MS SQL 2014 developer version I need to comment the others developer versions in main.yml file and need to change the product ID (mssql/tasks/run_mssql_setup.yml).

Is there any other solution where I can use branching/conditional statements to install different editions and versions of MS SQL Server without commenting the other version in main.yml file.

Below is the main.yml file which looks.

tasks file for mssql

Solved the issue using when conditions for the plays and it perfectly. Install MSSQL version and edition depends on the user input (vars_prompt) on the target machine.