none
SQL Server 2014 Enterprise Unattended Set up with Ansible

    Question

  • I've been playing around with ansible and with WinRM to manage windows servers and have been slightly successful with it to run basic commands.

    However when i try to run an exe file from within the powershell script, it fails.

    The same powershell script when i run from windows directly, it runs perfectly without any errors. The only error it throws out is an Access Denied error which would link to permissions, however being the Administrator, it should have full permissions no?

    The powershell script i try to run is:

    Write-Host "Installing SQL Server"
    C:\software-downloads\SQL\setup.exe /ConfigurationFile=C:\software-downloads\ConfigurationFile.ini

    The error Ansible throws out is:

    The following error occurred:
    There was an error generating the XML document.
    Error result: -2068774911
    Result facility code: 1201
    Result error code: 1
    Please review the summary.txt log for further details

    And looking at the summary log file it shows:

    Overall summary:
      Final result:                  Failed: see details below
      Exit code (Decimal):           -2068774911
      Exit facility code:            1201
      Exit error code:               1
      Exit message:                  There was an error generating the XML document.
      Start time:                    2016-06-24 06:47:55
      End time:                      2016-06-24 06:48:15
      Requested action:              Install
      Exception help link:           http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=12.0.4100.1&EvtType=0xE0C083E6%400xF80B8030&EvtType=0xE0C083E6%400xF80B8030
    
    
    Exception summary:
    The following is an exception stack listing the exceptions in outermost to innermost order
    Inner exceptions are being indented
    
    Exception type: Microsoft.SqlServer.Chainer.Infrastructure.ChainerInfrastructureException
        Message:
            There was an error generating the XML document.
        HResult : 0x84b10001
            FacilityCode : 1201 (4b1)
            ErrorCode : 1 (0001)
        Data:
          DisableWatson = true
        Stack:
            at Microsoft.SqlServer.Chainer.Infrastructure.DataStoreService.SerializeObject(String rootPath, Object objectToSerialize, Boolean saveToCache)
            at Microsoft.SqlServer.Chainer.Infrastructure.DataStoreService.SerializeObject(Object objectToSerialize)
            at Microsoft.SqlServer.Chainer.Infrastructure.InputSettingService.CalculateSettings(IEnumerable`1 settingIds)
            at Microsoft.SqlServer.Chainer.Infrastructure.InputSettingService.CalculateAllSettings(Boolean chainerSettingOnly)
            at Microsoft.SqlServer.Configuration.SetupExtension.FinalCalculateSettingsAction.ExecuteAction(String actionId)
            at Microsoft.SqlServer.Chainer.Infrastructure.Action.Execute(String actionId, TextWriter errorStream)
            at Microsoft.SqlServer.Setup.Chainer.Workflow.ActionInvocation.<>c__DisplayClasse.<ExecuteActionWithRetryHelper>b__b()
            at Microsoft.SqlServer.Setup.Chainer.Workflow.ActionInvocation.ExecuteActionHelper(ActionWorker workerDelegate)
        Inner exception type: System.InvalidOperationException
            Message:
                    There was an error generating the XML document.
            HResult : 0x80131509
            Stack:
                    at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
                    at System.Xml.Serialization.XmlSerializer.Serialize(TextWriter textWriter, Object o)
                    at Microsoft.SqlServer.Chainer.Infrastructure.DataStoreService.SerializeObject(String rootPath, Object objectToSerialize, Boolean saveToCache)
            Inner exception type: System.Security.Cryptography.CryptographicException
                Message:
                            Access is denied.
    
                HResult : 0x80070005
                Stack:
                            at System.Security.Cryptography.ProtectedData.Protect(Byte[] userData, Byte[] optionalEntropy, DataProtectionScope scope)
                            at Microsoft.SqlServer.Common.SqlSecureString.WriteXml(XmlWriter writer)
                            at System.Xml.Serialization.XmlSerializationWriter.WriteSerializable(IXmlSerializable serializable, String name, String ns, Boolean isNullable, Boolean wrapped)
                            at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterAgentConfigurationPublic.Write6_AgentConfigurationPublic(String n, String ns, AgentConfigurationPublic o, Boolean isNullable, Boolean needType)
                            at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterAgentConfigurationPublic.Write7_AgentConfigurationPublic(Object o)

    The exception help link doesn't go anywhere either when I click on it.

    I tried passing the credentials as well with Start-Process but that doesn't work either as I'm probably using it wrong since i have to pass the configuration file in as a parameter.

    I've run the following ansible script on the Windows Host: https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1

    And I know it's working fine as I can run other scripts which include, downloading files from S3 and auto-joining to a domain.

    Has anyone successfully installed an exe file in windows via ansible? Any help will awesome, as maybe I might even have over-looked something simple?
    Monday, June 27, 2016 4:24 AM

All replies

  • Hi Nikhil.C ,

    According to your description, the issue is caused by second hop. You can setup Multi-Hop Support in winRM by using the following steps. For more information, you can review this article: https://msdn.microsoft.com/en-us/library/ee309365(v=vs.85).aspx .

      1. Enable CredSSP in the client configuration settings.
      2. Enable CredSSP in the WinRM service configuration settings.
      3. Enable the AllowFreshCredentials policy setting on the WinRM client.
      4. Configure an HTTPS or HTTP listener on the server.

    In addition, PowerShell 3.0 is required when using ansible to control it remotely, thus please make sure you have PowerShell 3.0 or higher version installed.

    If you have any other questions, please let me know.

    Regards,
    Teige

    Tuesday, June 28, 2016 8:56 AM
    Moderator
  • Hello Tiege,

    Followed the above steps but still the same error prevails.

    Exception summary:
    The following is an exception stack listing the exceptions in outermost to innermost order
    Inner exceptions are being indented
    
    Exception type: Microsoft.SqlServer.Chainer.Infrastructure.ChainerInfrastructureException
        Message: 
            There was an error generating the XML document.
        HResult : 0x84b10001
            FacilityCode : 1201 (4b1)
            ErrorCode : 1 (0001)
        Data: 
          DisableWatson = true
        Stack: 
            at Microsoft.SqlServer.Chainer.Infrastructure.DataStoreService.SerializeObject(String rootPath, Object objectToSerialize, Boolean saveToCache)
            at Microsoft.SqlServer.Chainer.Infrastructure.DataStoreService.SerializeObject(Object objectToSerialize)
            at Microsoft.SqlServer.Chainer.Infrastructure.InputSettingService.CalculateSettings(IEnumerable`1 settingIds)
            at Microsoft.SqlServer.Chainer.Infrastructure.InputSettingService.CalculateAllSettings(Boolean chainerSettingOnly)
            at Microsoft.SqlServer.Configuration.SetupExtension.FinalCalculateSettingsAction.ExecuteAction(String actionId)
            at Microsoft.SqlServer.Chainer.Infrastructure.Action.Execute(String actionId, TextWriter errorStream)
            at Microsoft.SqlServer.Setup.Chainer.Workflow.ActionInvocation.<>c__DisplayClasse.<ExecuteActionWithRetryHelper>b__b()
            at Microsoft.SqlServer.Setup.Chainer.Workflow.ActionInvocation.ExecuteActionHelper(ActionWorker workerDelegate)
        Inner exception type: System.InvalidOperationException
            Message: 
                    There was an error generating the XML document.
            HResult : 0x80131509
            Stack: 
                    at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
                    at System.Xml.Serialization.XmlSerializer.Serialize(TextWriter textWriter, Object o)
                    at Microsoft.SqlServer.Chainer.Infrastructure.DataStoreService.SerializeObject(String rootPath, Object objectToSerialize, Boolean saveToCache)
            Inner exception type: System.Security.Cryptography.CryptographicException
                Message: 
                            Access is denied.
                            
                HResult : 0x80070005
                Stack: 
                            at System.Security.Cryptography.ProtectedData.Protect(Byte[] userData, Byte[] optionalEntropy, DataProtectionScope scope)
                            at Microsoft.SqlServer.Common.SqlSecureString.WriteXml(XmlWriter writer)
                            at System.Xml.Serialization.XmlSerializationWriter.WriteSerializable(IXmlSerializable serializable, String name, String ns, Boolean isNullable, Boolean wrapped)
                            at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterAgentConfigurationPublic.Write6_AgentConfigurationPublic(String n, String ns, AgentConfigurationPublic o, Boolean isNullable, Boolean needType)
                            at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterAgentConfigurationPublic.Write7_AgentConfigurationPublic(Object o)

    I'm using PowerShell 4.0 as well. The HTTPS Listener was already configured with the WinRM script i ran earlier.

    I'm stumped at this situation as to what else could be causing this. Any other ideas i could try?

    In Addition: When i run Get-WSManCredSSP in Powershell, I get:

    The machine is not configured to allow delegating fresh credentials.
    This computer is configured to receive credentials from a remote client computer.

    But the group policy has already been created. Any thoughts?

    Cheers,

    Nick




    • Edited by Nikhil.C Wednesday, June 29, 2016 5:01 AM Added additional details
    Wednesday, June 29, 2016 4:54 AM
  • Hi Nikhil.C were you able to resolve this issue?

    I'm experiencing the same issue rolling out SQL 2014 with Ansible as you described and can't find the answer.

    Thanks!

    Gr.

    Wesley

    Friday, December 30, 2016 8:13 AM
  • Hi,

    I had similar problems.

    After installing those windows features (with ansible win_feature) problem was solved:

    - NET-Framework-Core
    - NET-Framework-Features
    - NET-Framework-45-Features
    - NET-Framework-45-Core
    - NET-Framework-45-ASPNET


    Sunday, February 12, 2017 12:04 AM
  • Can you provide the configuration file you are trying to pass to the install?

    Joie Andrew "Since 1982"

    Sunday, February 12, 2017 11:23 AM
  • Something like this:

    D:\Temp\MSSQL_2014_Standard_MSDN\setup.exe /Q /ACTION=Install /IACCEPTSQLSERVERLICENSETERMS /ENU /UPDATEENABLED="false" /FEATURES="SQLENGINE,SSMS,ADV_SSMS" /INSTANCENAME="MSSQLSERVER" /SECURITYMODE="SQL" /SAPWD="P@$$w0rd" /AGTSVCSTARTUPTYPE="automatic" /BROWSERSVCSTARTUPTYPE="automatic" /SQLSYSADMINACCOUNTS="sqladmin" /SQLBACKUPDIR="D:\Backup" /SQLUSERDBDIR="e:\Databases" /SQLUSERDBLOGDIR="f:\Databases"

    Sunday, February 12, 2017 12:33 PM
  • I wonder if running this on a PowerShell session is an issue. Not sure with configuration files, but I know if running with install parameters I have issues with dollar signs as they are a special character in the PowerShell console. I normally have to escape them out to get them work. Could that be the issue here?

    If you change your SAPWD parameter not to use characters other than dollar signs and retry does it still give you the same error?


    Joie Andrew "Since 1982"

    Sunday, February 12, 2017 12:42 PM
  • Hello everyone,

    I am trying to install SQL Server 2008 on a Windows 2008R2 machine thru Ansible and having the same exact issue / error as other folks on this thread reported.

    Ansible Version: 2.3.1.0

    PyWinRM Version: 0.2.2

    Target Host Details: Windows 2008R2, PS Version is 4.0 

    Output of winrm qc

    PS C:\Users\tempadmin> winrm qc
    WinRM service is already running on this machine.
    WinRM is already set up for remote management on this computer.

    Output of WSManCredSSP:

    PS C:\Users\tempadmin> WSManCredSSP
    The machine is not configured to allow delegating fresh credentials.
    This computer is configured to receive credentials from a remote client computer.

    My Ansible Task:

    - name: Install Microsoft SQL Server
      raw: "C:\\TN\\sql\\setup.exe /ConfigurationFile=C:\\TN\\sqlconfigfile.ini"

    Detailed Ansible Error:

    <10.10.68.169> ESTABLISH WINRM CONNECTION FOR USER: Tempadmin on PORT 5986 TO 10.10.68.169
    EXEC (via pipeline wrapper)
    fatal: [SQLINSTTEST01]: FAILED! => {
        "changed": true,
        "failed": true,
        "rc": 2226192385,
        "stderr": "\r\n",
        "stdout": "The following error occurred:\r\nThere was an error generating the XML document.\r\n\r\nError result: -2068774911\r\nResult facility code: 1201\r\nResult error code: 1\r\n\r\nPlease review the summary.txt log for further details\r\nMicrosoft (R) SQL Server 2008 Setup 10.00.1600.22\r\n\r\nCopyright (c) Microsoft Corporation.  All rights reserved.\r\n\r\n\r\n",
        "stdout_lines": [
            "The following error occurred:",
            "There was an error generating the XML document.",
            "",
            "Error result: -2068774911",
            "Result facility code: 1201",
            "Result error code: 1",
            "",
            "Please review the summary.txt log for further details",
            "Microsoft (R) SQL Server 2008 Setup 10.00.1600.22",
            "",
            "Copyright (c) Microsoft Corporation.  All rights reserved.",
            "",
            ""
        ]
    }


    Error in Summary.txt log

    I am not pasting it here again 'coz it is the same exact error as encountered by Mr. Nikhil, C in this thread.

    Note: When I execute the silent install command locally on the windows machine, it works perfectly. (Both from Powershell and Command Prompt). (Takes ~09 minutes to get all components installed)

    I would really appreciate it if someone could please tell what exactly is causing this issue and suggest a solution or workaround to get past this issue.

    Thank You....

    • Proposed as answer by HiteshVeer Thursday, August 24, 2017 3:29 PM
    • Unproposed as answer by HiteshVeer Thursday, August 24, 2017 3:29 PM
    Monday, July 31, 2017 7:10 PM
  • Used win_psexec module and it worked like a charm. Here is the module I used.

    Prerequisite to use this module: You need to have psexec.exe on your target machine.

    - name: Install MS SQL Server using psexec module
      win_psexec:
       command: C:\TN\sql\setup.exe /ConfigurationFile=C:\\TN\\sqlconfigfile.ini /INDICATEPROGRESS=False
       priority: high
       executable: C:\TN\PsExec.exe

    Thanks,

    Hitesh


    Thursday, August 24, 2017 3:35 PM