SQL Server 2019 Installation Failing

54 views
Skip to first unread message

Praveen Kumar Singh

unread,
Jan 31, 2021, 5:36:55 AM1/31/21
to Ansible Project
Dear All,

I am getting below error while installing SQL server 2019. Also below is the playbook that I am using. So can someone please help.

Capture.PNG

---
 - hosts: SQLSERVER2
   vars:

     ManagementStudio_LOCATION: L:\Ansible\SSMS-Setup-ENU.exe
     SQLSERVER_EXE_LOCATION: L:\Ansible\SQLServer2019-x64-ENU-Dev.iso
     SQLSERVER_EXE_LOCATION_Mount: G:\
     BACKUPDIR: E:\BACKUP
     SQLDATADIR: D:\SQLDATA
     SQLLOGDIR: L:\SQLLOG
     TEMPDBDIR: F:\SQLDATA
     TEMPDBLOG: F:\SQLLOG
     SYSADMINACC: sa
     SAPWD: xyz
     SERVICEACCOUNTFORSQLADMIN: abc
     Domain_ACC: xyz
     Domain_ACC_Password: abc


   tasks:

     - name: Create directory structure
       win_file:
         path: "{{ item }}"
         state: directory
       with_items:
           - F:\Ansible
           - F:\Ansible\SQLISO
           - F:\Ansible\CU
           - E:\BACKUP
           - D:\SQLDATA
           - L:\SQLLOG
       tags:
         - Dir_Structures

     - name: SSMS installation
       win_command: "{{ ManagementStudio_LOCATION }} /install /quiet /restart"
       notify: "Restart Servers"
       tags:
         - SSMS

     - name: Ensure my SQL ISO is mounted
       win_disk_image:
         image_path: '{{ SQLSERVER_EXE_LOCATION }}'
         state: present
       register: disk_image_out
       tags:
         - mount



     - name: SQL SERVER INSTALLATION

       win_command: setup.exe /IACCEPTSQLSERVERLICENSETERMS /ACTION="install" /ENU="True" /UIMODE="Normal" /UpdateEnabled="false" /UpdateSource="MU" /HELP="False" /INDICATEPROGRESS="False" /INSTALLSHAREDDIR="C:\Program Files\Microsoft SQL Server"
         /INSTALLSHAREDWOWDIR="C:\Program Files (x86)\Microsoft SQL Server"
         /INSTANCEDIR="C:\Program Files\Microsoft SQL Server"
         /FEATURES=SQLENGINE,REPLICATION,DQC,CONN,BC,SDK /INSTANCENAME=MSSQLSERVER
         /INSTANCEID="MSSQLSERVER" /SQLSVCACCOUNT="NT Service\MSSQLSERVER"
         /AGTSVCACCOUNT="NT Service\SQLSERVERAGENT" /AGTSVCSTARTUPTYPE="Automatic"
         /SQLSVCSTARTUPTYPE="Automatic" /SQLCOLLATION="SQL_Latin1_General_CP1_CI_AS"
         /SQLSVCACCOUNT="NT Service\MSSQLSERVER" /SQLSYSADMINACCOUNTS="{{ SERVICEACCOUNTFORSQLADMIN }}"
         /INSTALLSQLDATADIR= "{{ SQLDATADIR }}" /SQLUSERDBLOGDIR="{{ SQLLOGDIR }}" /SECURITYMODE="SQL"
         /SAPWD="{{ SAPWD }}" /SQLBACKUPDIR="{{ BACKUPDIR }}" /SQLTEMPDBDIR="{{ TEMPDBDIR }}" /SQLTEMPDBLOGDIR="{{ TEMPDBLOG }}"
         /SQLTEMPDBFILECOUNT="1"

       args:
         executable: cmd
         chdir: '{{ SQLSERVER_EXE_LOCATION_Mount }}'
       ignore_errors: yes
       notify: "Restart Servers"
       tags:
         - SQLSERVER



     - name: Set the log on user to a domain account for SqlServer service
       win_service:
         name: MSSQLSERVER
         state: restarted
         username: '{{ Domain_ACC }}'
         password: '{{ Domain_ACC_Password }}'
         force_dependent_services: yes
       tags:
         - DA1

     - name: Set the log on user to a domain account for SqlAgent service
       win_service:
         name: SQLSERVERAGENT
         state: restarted
         username: '{{ Domain_ACC }}'
         password: '{{ Domain_ACC_Password }}'
         force_dependent_services: yes
       tags:
         - DA2

   handlers:
     - name: reboot servers
       win_reboot:
       listen: "Restart Servers"

Thanks and Regards,
Praveen Singh






Rahul Puli

unread,
Jan 31, 2021, 8:55:54 AM1/31/21
to ansible...@googlegroups.com
Praveen,

Can you check the installed SQL Server services?

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 ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/0bee67e4-66fe-4ac1-8d6f-26cc85162bbbn%40googlegroups.com.

Praveen Kumar Singh

unread,
Jan 31, 2021, 9:05:49 AM1/31/21
to ansible...@googlegroups.com
Hello Rahul,

No SQL services were installed due to which I got that error.

Thanks and Regards,
Praveen Singh

Praveen Kumar Singh

unread,
Feb 1, 2021, 12:35:52 PM2/1/21
to ansible...@googlegroups.com
Can someone please help me with this?

Thanks and regards,
Praveen Singh

jbor...@gmail.com

unread,
Feb 1, 2021, 5:32:59 PM2/1/21
to Ansible Project
You are ignoring errors on your win_command task that is actually installing SQL so when you go to configure the service it is failing because it isn't installed. You should only ignore_errors if you truely don't care if it fails or not, if it is failing then you need to solve that problem first.

As for installing SQL Server it's a bit tricky because it needs to access the DPAPI store for your current user. By default a WInRM connection will not be able to access this due to how it actually logs in the account. In short you need to either use CredSSP as your WinRM authentication or use become on the task with explicit credentials to bypass this DPAPI limitation https://docs.ansible.com/ansible/latest/user_guide/become.html#become-and-windows.
Reply all
Reply to author
Forward
0 new messages