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

**URL:** <https://forum.ansible.com/t/branching-conditional-statements-to-install-different-editions-and-versions-of-ms-sql-server/33786>\
**Category:** Ansible Project\
**Created:** [September 10, 2020, 2:51pm UTC](https://forum.ansible.com/t/branching-conditional-statements-to-install-different-editions-and-versions-of-ms-sql-server/33786 "2020-09-10T14:51:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rahul\_Puli](https://avatars.discourse-cdn.com/v4/letter/r/82dd89/32.png) [@Rahul\_Puli](https://forum.ansible.com/u/Rahul_Puli)\
**Post date:** [September 10, 2020, 2:51pm UTC](https://forum.ansible.com/t/branching-conditional-statements-to-install-different-editions-and-versions-of-ms-sql-server/33786/1 "2020-09-10T14:51:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Rahul\_Puli](https://avatars.discourse-cdn.com/v4/letter/r/82dd89/32.png) [@Rahul\_Puli](https://forum.ansible.com/u/Rahul_Puli)\
**Post date:** [September 24, 2020, 11:27am UTC](https://forum.ansible.com/t/branching-conditional-statements-to-install-different-editions-and-versions-of-ms-sql-server/33786/2 "2020-09-24T11:27:55Z")

</div>

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.
