ここ数日間は、開発/テスト環境を作成しようとしています。ここでは、DSCを使用した導入を自動化できます。Powershell DSCクライアントはプルサーバーに登録できません
私はWMF5.1を使用しています。
pullserverは、例を使用して設定されていますSample_xDscWebServiceRegistrationWithSecurityBestPractices xPSDesiredStateConfiguration 5.1.0.0から
。
configuration Sample_xDscWebServiceRegistrationWithSecurityBestPractices
{
param
(
[string[]]$NodeName = 'CORE-O-DSCPull.CORE.local',
[ValidateNotNullOrEmpty()]
[string] $certificateThumbPrint,
[Parameter(HelpMessage='This should be a string with enough entropy (randomness) to protect the registration of clients to the pull server. We will use new GUID by default.')]
[ValidateNotNullOrEmpty()]
[string] $RegistrationKey # A guid that clients use to initiate conversation with pull server
)
Import-DSCResource -ModuleName xPSDesiredStateConfiguration -ModuleVersion '5.1.0.0'
Node $NodeName
{
WindowsFeature DSCServiceFeature
{
Ensure = "Present"
Name = "DSC-Service"
}
xDscWebService PSDSCPullServer
{
Ensure = "Present"
EndpointName = "PSDSCPullServer"
Port = 8080
PhysicalPath = "$env:SystemDrive\inetpub\wwwroot\PSDSCPullServer"
CertificateThumbPrint = $certificateThumbPrint
ModulePath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules"
ConfigurationPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration"
State = "Started"
DependsOn = "[WindowsFeature]DSCServiceFeature"
RegistrationKeyPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService"
AcceptSelfSignedCertificates = $true
UseSecurityBestPractices = $true
}
File RegistrationKeyFile
{
Ensure = 'Present'
Type = 'File'
DestinationPath = "$env:ProgramFiles\WindowsPowerShell\DscService\RegistrationKeys.txt"
Contents = $RegistrationKey
}
}
}
MOF
ファイルを私のプルサーバーに問題なく適用します。私は問題なく私のプルのサーバーにLCM設定を適用
[DSCLocalConfigurationManager()]
configuration Sample_MetaConfigurationToRegisterWithSecurePullServer
{
param
(
[ValidateNotNullOrEmpty()]
[string] $NodeName = 'CORE-O-DSCPull.CORE.local',
[ValidateNotNullOrEmpty()]
[string] $RegistrationKey, #same as the one used to setup pull server in previous configuration
[ValidateNotNullOrEmpty()]
[string] $ServerName = 'CORE-O-DSCPull.CORE.local' #node name of the pull server, same as $NodeName used in previous configuration
)
Node $NodeName
{
Settings
{
RefreshMode = 'Pull'
}
ConfigurationRepositoryWeb CORE-O_PullSrv
{
ServerURL = "https://$ServerName`:8080/PSDSCPullServer.svc" # notice it is https
RegistrationKey = $RegistrationKey
ConfigurationNames = @('Basic')
}
}
}
:私は、同じ例を使用してメタMOF
を作成します。 私は単純なbasic.mofを作成し、それを適用するためにDSCを使うことができます。すべてこれはうまく動作します。
次に、他のノード用の別のmeta.mofファイルを作成してプルサーバに登録させます。他のノードの名前に変更するnodename
を除いて、私は上記と同じ構成を使用します。
Set-DscLocalConfigurationManager -ComputerName <nodename> -path <pathtonewmetamof>
このコマンドは正しく動作します。その後、そのマシンはDSCを使用して問題なく同じbasic.mof
を適用することができます。
ここで問題が発生します: プルサーバーとノードを再起動して、新しいbasic.mofを作成し、これを両方のマシンに適用しようとします。この手順はプルサーバー自体で正常に動作しますが、自分のプルサーバーに登録されなくなるため、自分のノードはbasic.mofを適用できなくなります。私はこれを何度も複製しています。ここでは、両方のマシンを一からインストールして構成します。私のマシンを再起動するたびに、登録は機能しなくなります。以下のエラーを参照してください:
Registration of the Dsc Agent with the server https://CORE-O-DSCPull.CORE.local:8080/PSDSCPullServer.svc failed. The underlying error is: Failed to register Dsc
Agent with AgentId 1FE837AA-C774-11E6-80B5-9830B2A0FAC0 with the server
https://core-o-dscpull.core.local:8080/PSDSCPullServer.svc/Nodes(AgentId='1FE837AA-C774-11E6- 80B5-9830B2A0FAC0'). .
+ CategoryInfo : InvalidResult: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : RegisterDscAgentCommandFailed,Microsoft.PowerShell.DesiredStateConfiguration.Commands.RegisterDscAgentCommand
+ PSComputerName : CORE-O-DC.CORE.local
私の問題は、プルサーバーを再起動するまで登録が正常に機能しているようです。誰でもこの問題を引き起こす可能性のあるアイデアはありますか?
これを回答としてマークできますか?調査したい場合は、問題を再現し、[プルサーバから診断データを収集する](https://github.com/PowerShell/xdscDiagnostics#gather-diagnostics-for-the-dsc-pull-server-and- windows-data-points)。個人的に私にデータを取得する方法について私にメッセージを送ることができます。 – TravisEz13