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.

On Tuesday, February 2, 2021 at 3:35:52 AM UTC+10 prav...@tibco.com wrote:

> Can someone please help me with this?
>
> Thanks and regards,
> Praveen Singh
>
> On Sun, Jan 31, 2021 at 6:05 AM Praveen Kumar Singh <prav...@tibco.com> 
> wrote:
>
>> Hello Rahul,
>>
>> No SQL services were installed due to which I got that error.
>>
>> Thanks and Regards,
>> Praveen Singh
>>
>>
>> On Sun, Jan 31, 2021, 7:25 PM Rahul Puli <rahul....@gmail.com> wrote:
>>
>>> Praveen,
>>>
>>> Can you check the installed SQL Server services?
>>>
>>> Thanks,
>>> Rahul
>>>
>>> On Sun, Jan 31, 2021 at 4:07 PM 'Praveen Kumar Singh' via Ansible 
>>> Project <ansible...@googlegroups.com> wrote:
>>>
>>>> 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.
>>>>
>>>> [image: 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
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> -- 
>>>> 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
>>>>  
>>>> <https://groups.google.com/d/msgid/ansible-project/0bee67e4-66fe-4ac1-8d6f-26cc85162bbbn%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 ansible-proje...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/ansible-project/CAK8vF9KpRYag7Q4_CNbLF6UyEGi0PQk7-cYDXZOdJ84WwqaMjg%40mail.gmail.com
>>>  
>>> <https://groups.google.com/d/msgid/ansible-project/CAK8vF9KpRYag7Q4_CNbLF6UyEGi0PQk7-cYDXZOdJ84WwqaMjg%40mail.gmail.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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f46f0588-f7a8-4d00-a7b5-b421edd88d99n%40googlegroups.com.

Reply via email to