diff --git a/files/sql_conf.ini.j2 b/files/sql_conf.ini.j2 new file mode 100644 index 0000000..130268a --- /dev/null +++ b/files/sql_conf.ini.j2 @@ -0,0 +1,46 @@ +#jinja2: newline_sequence:"\r\n" +;SQL Server 2014 Configuration File +[OPTIONS] +IACCEPTSQLSERVERLICENSETERMS="True" +ACTION="Install" +ENU="True" +QUIET="True" +QUIETSIMPLE="False" +UpdateEnabled="False" +ERRORREPORTING="False" +USEMICROSOFTUPDATE="False" +FEATURES=SQLENGINE,FULLTEXT,DQ,RS,SSMS,ADV_SSMS +UpdateSource="MU" +HELP="False" +INDICATEPROGRESS="False" +X86="False" +INSTALLSHAREDDIR="C:\Program Files\Microsoft SQL Server" +INSTALLSHAREDWOWDIR="C:\Program Files (x86)\Microsoft SQL Server" +INSTANCENAME="{{ sql_instance_name }}" +SQMREPORTING="False" +INSTANCEID="{{ sql_instance_name }}" +RSINSTALLMODE="DefaultNativeMode" +INSTANCEDIR="C:\Program Files\Microsoft SQL Server" +AGTSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE" +AGTSVCPASSWORD="P@ssw0rd" +AGTSVCSTARTUPTYPE="Automatic" +COMMFABRICPORT="0" +COMMFABRICNETWORKLEVEL="0" +COMMFABRICENCRYPTION="0" +MATRIXCMBRICKCOMMPORT="0" +SQLSVCSTARTUPTYPE="Automatic" +FILESTREAMLEVEL="0" +ENABLERANU="False" +SQLCOLLATION="SQL_Latin1_General_CP1_CI_AS" +SQLSVCACCOUNT="{{ ansible_hostname }}\vagrant" +SQLSVCPASSWORD="vagrant" +SQLSYSADMINACCOUNTS="BUILTIN\Administrators" +ADDCURRENTUSERASSQLADMIN="True" +TCPENABLED="1" +NPENABLED="0" +BROWSERSVCSTARTUPTYPE="Disabled" +RSSVCACCOUNT="" +RSSVCPASSWORD="P@ssw0rd" +RSSVCSTARTUPTYPE="manual" +IACCEPTSQLSERVERLICENSETERMS="True" +FTSVCACCOUNT="NT Service\MSSQLFDLauncher" diff --git a/files/sql_conf.ini.j2_working b/files/sql_conf.ini.j2_working new file mode 100644 index 0000000..9764be0 --- /dev/null +++ b/files/sql_conf.ini.j2_working @@ -0,0 +1,46 @@ +#jinja2: newline_sequence:"\r\n" +;SQL Server 2014 Configuration File +[OPTIONS] +IACCEPTSQLSERVERLICENSETERMS="True" +ACTION="Install" +ENU="True" +QUIET="True" +QUIETSIMPLE="False" +UpdateEnabled="False" +ERRORREPORTING="False" +USEMICROSOFTUPDATE="False" +FEATURES=SQLENGINE,FULLTEXT,DQ,RS,SSMS,ADV_SSMS +UpdateSource="MU" +HELP="False" +INDICATEPROGRESS="False" +X86="False" +INSTALLSHAREDDIR="C:\Program Files\Microsoft SQL Server" +INSTALLSHAREDWOWDIR="C:\Program Files (x86)\Microsoft SQL Server" +INSTANCENAME="{{ sql_instance_name }}" +SQMREPORTING="False" +INSTANCEID="{{ sql_instance_name }}" +RSINSTALLMODE="DefaultNativeMode" +INSTANCEDIR="C:\Program Files\Microsoft SQL Server" +AGTSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE" +AGTSVCPASSWORD="P@ssw0rd" +AGTSVCSTARTUPTYPE="Automatic" +COMMFABRICPORT="0" +COMMFABRICNETWORKLEVEL="0" +COMMFABRICENCRYPTION="0" +MATRIXCMBRICKCOMMPORT="0" +SQLSVCSTARTUPTYPE="Automatic" +FILESTREAMLEVEL="0" +ENABLERANU="False" +SQLCOLLATION="SQL_Latin1_General_CP1_CI_AS" +SQLSVCACCOUNT="NT Service\MSSQL$SQLEXPRESS" +SQLSVCPASSWORD="P@ssw0rd" +SQLSYSADMINACCOUNTS=“BUILTIN\Administrators" +ADDCURRENTUSERASSQLADMIN="True" +TCPENABLED="1" +NPENABLED="0" +BROWSERSVCSTARTUPTYPE="Disabled" +RSSVCACCOUNT="" +RSSVCPASSWORD="P@ssw0rd" +RSSVCSTARTUPTYPE="manual" +IACCEPTSQLSERVERLICENSETERMS="True" +FTSVCACCOUNT="NT Service\MSSQLFDLauncher" diff --git a/win_sql_install.yml b/win_sql_install.yml new file mode 100644 index 0000000..e73aea0 --- /dev/null +++ b/win_sql_install.yml @@ -0,0 +1,48 @@ +- hosts: all + gather_facts: True + vars: + sql_instance_name: benz + tasks: + - debug: var=hostvars[inventory_hostname] + - name: create a directory for installer download + win_file: + path: c:\sql + state: directory + + - name: create a directory for installer extraction + win_file: + path: c:\sql\installer + state: directory + + - name: create the configuration file + win_template: + src: files/sql_conf.ini.j2 + dest: c:\sql\sql_conf.ini + + - name: a pre requisite of sql net-framework-35 + win_feature: + name: NET-Framework-Core + state: present + + - name: check downloaded file exists + win_stat: + path: c:\sql\sql_installer.exe + register: installer_file + + - name: get the installer + win_get_url: + url: 'http://download.microsoft.com/download/E/A/E/EAE6F7FC-767A-4038-A954-49B8B05D04EB/ExpressAndTools%2064BIT/SQLEXPRWT_x64_ENU.exe' + dest: 'c:\sql\sql_installer.exe' + when: not installer_file.stat.exists + + - name: extract the installer + win_command: c:\sql\sql_installer.exe /q /x:c:\sql\installer + args: + chdir: c:\sql + creates: c:\sql\installer\setup.exe + + - name: Install the database + win_command: c:\sql\installer\setup.exe /configurationfile=c:\sql\sql_conf.ini + args: + chdir: c:\sql +