最近Windowsマシンを管理するようにansibleを構成するには、winrmサービスを有効にする必要があるため、Windowsプラットフォームでwinrmサービスを有効にする必要があります。
私の環境はWindows10 EnterpriseEditionです。
winrmサービスはデフォルトでは有効になっていないため、最初にwinrmサービスを開始します。
最初のステップは、winrmサービスを遅延開始に設定し、サービスを開始することです。
2番目のステップは、管理者としてPowerShellを実行し、次のスクリプトを実行することです。
$url = "https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1"
$file = "$env:temp\ConfigureRemotingForAnsible.ps1"
(New-Object -TypeName System.Net.WebClient).DownloadFile($url, $file)
powershell.exe -ExecutionPolicy ByPass -File $file
以下に示すように実行後
3番目のステップは、非暗号化を許可するようにwinrmサービスの暗号化方法を構成することです。
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
上記の手順を実行した後、Windowsの構成は問題ありません。
参考資料:https://docs.ansible.com/ansible/latest/user_guide/windows_setup.html