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.
--- # tasks file for mssql - include: download_sqlexpress2012.yml when: sql_version == "2012" and sql_release == "exp" - include: download_sqlexpress2014.yml when: sql_version == "2014" and sql_release == "exp" - include: download_sqlexpress2016.yml when: sql_version == "2016" and sql_release == "exp" - include: download_sqlexpress2017.yml when: sql_version == "2017" and sql_release == "exp" - include: download_sqlexpress2019.yml when: sql_version == "2019" and sql_release == "exp" - include: extract_sqlexpress_setup.yml when: sql_release == "exp" - include: mssql_exp_configuration_file.yml when: sql_release == "exp" - include: run_mssql_exp_setup.yml when: sql_release == "exp" #-------- MSSQL DEVELOPER --------- - include: download_mssql_2014_developer.yml when: sql_version == "2014" and sql_release == "dev" - include: download_mssql_2016_developer.yml when: sql_version == "2016" and sql_release == "dev" - include: download_mssql_2017_developer.yml when: sql_version == "2017" and sql_release == "dev" - include: download_mssql_2019_developer.yml when: sql_version == "2019" and sql_release == "dev" On Thu, Sep 10, 2020 at 8:21 PM Rahul puli <[email protected]> wrote: > 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 > > --- > > - include: createtemporaryfolder.yml > > - include: install_dotnet3.5.yml > > - include: install_dotnet4.5.yml > > > > #-------- MSSQL DEVELOPER --------- > > > > - include: download_mssql_2014_developer.yml > > #- include: download_mssql_2016_developer.yml > > #- include: download_mssql_2017_developer.yml > > #- include: download_mssql_2019_developer.yml > > . > > . > > . > > > > > You can get see the role from the below link > > https://github.com/rahulpuli/Install-MSSQL-Devloper-edition-using-Ansible > > > Thanks, > > Rahul > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/3ca0f81f-3c3a-48a9-9ddf-61f96f0faf0an%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/3ca0f81f-3c3a-48a9-9ddf-61f96f0faf0an%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAK8vF9Kg9kUix0nCeMy_8NKvQ3i8q5zzAnRo8QSsYzwViqy4kg%40mail.gmail.com.
