Ansible win_ds c не удается установить SqlServer с SqlServerDsc - PullRequest
2 голосов
/ 16 марта 2020

Я пытаюсь установить SQLServer 2019 на Windows Сервер 2019 с использованием ansible и SqlServerDsc Я получаю сообщение об ошибке об отсутствии CimClass MSFT_SqlSetup. Кажется, что-то не хватает для установки или?

The full traceback is:
Not found 
At line:50 char:17
+ ... $resource = Get-CimClass -ClassName $ClassName -Namespace root\Micros ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (root\Microsoft\...n:MSFT_SqlSetup:String) [Get-CimClass], CimException
    + FullyQualifiedErrorId : HRESULT 0x80041002,Microsoft.Management.Infrastructure.CimCmdlets.GetCimClassCommand

ScriptStackTrace:
at Get-DscCimClassProperties, <No file>: line 50
at Get-OptionSpec, <No file>: line 150
at <ScriptBlock>, <No file>: line 376

Microsoft.Management.Infrastructure.CimException: Not found 
   at Microsoft.Management.Infrastructure.Internal.Operations.CimAsyncObserverProxyBase`1.ProcessNativeCallback(OperationCallbackProcessingContext callbackProcessingContext, T currentItem, Boolean moreResults, MiResult operationResult, String errorMessage, InstanceHandle errorDetailsHandle)
fatal: [192.168.56.5]: FAILED! => {
    "changed": false,
    "msg": "Unhandled exception while executing module: Not found "
}

Запуск ansible 2.9.6

ansible --version
ansible 2.9.6

Я работаю Windows Сервер 2019 с Powershell 5.1

PS> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.17763.592
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.592
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

SqlServerDs c 13.3.0

PS> Get-DscResource -Name SqlSetup

ImplementedAs   Name                      ModuleName                     Version    Properties
-------------   ----                      ----------                     -------    ----------
PowerShell      SqlSetup                  SqlServerDsc                   13.3.0     {InstanceName, Action, AgtSvcAcc...

Результат Get-CimClass

PS> Get-CimClass -ClassName MSFT_SqlSetup -Namespace root/Microsoft/Windows/DesiredStateConfiguration
Get-CimClass : Not found
At line:1 char:1
+ Get-CimClass -ClassName MSFT_SqlSetup -Namespace root/Microsoft/Windo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (root/Microsoft/...n:MSFT_SqlSetup:String) [Get-CimClass], CimException
    + FullyQualifiedErrorId : HRESULT 0x80041002,Microsoft.Management.Infrastructure.CimCmdlets.GetCimClassCommand

PSModulePath

PS> Get-ChildItem -Path Env:\PSModulePath | select value | fl *


Value : C:\Users\Administrator\Documents\WindowsPowerShell\Modules;C:\Program
        Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules

MOF

PS> Get-ChildItem -Path c:\ -Filter MSFT_SqlSetup*.mof -Recurse -Name
Program Files\WindowsPowerShell\Modules\SqlServerDsc\13.3.0\DSCResources\MSFT_SqlSetup\MSFT_SqlSetup.schema.mof

Мой ansible звонок

- name: Windows | Install SQL Server
  win_dsc:
    resource_name: SqlSetup
    Action: Install
    InstanceName: '{{ mssql_instance_name }}'
    SourcePath: '{{ mount_info.mount_paths[0] }}'
    Features: SQLENGINE
    ProductKey: '{{ mssql_pid | d(omit)}}'
    UpdateEnabled: False
    InstallSharedDir: C:\Program Files\Microsoft SQL Server
    InstallSharedwowDir: C:\Program Files (x86)\Microsoft SQL Server
    InstanceDir: C:\Program Files\Microsoft SQL Server
    SQLCollation: French_CI_AS
    SQLSysAdminAccounts: BUILTIN\Administrators
    SecurityMode: SQL
    SAPwd_username: sa
    SAPwd_password: '{{ mssql_sa_password }}'
    SQLUserDBDir: C:\MSSQL\Data
    SQLUserDBLogDir: C:\MSSQL\DataLogs
    SQLTempDBDir: C:\MSSQL\TempDB
    SQLTempDBLogDir: C:\MSSQL\TempDBLogs
    SQLBackupDir: C:\MSSQL\Backup
    SqlSvcStartupType: Automatic
    AgtSvcStartupType: Manual
    AsSvcStartupType: Manual
    BrowserSvcStartupType: Manual
    PsDscRunAsCredential_username: '{{ ansible_user | d(omit) }}'
    PsDscRunAsCredential_password: '{{ ansible_password | d(omit)}}'

Спасибо за вашу помощь

ОБНОВЛЕНИЕ:

Ошибка происходит только когда прослушиватель WinRM HTTP удаляется, и только прослушиватель HTTPS активен.

выпуск Github 32 открыт

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...