Use ansible to manage the Windows configuration of the Windows host

To configure ansible to manage Windows machines recently, you need to enable the winrm service, so you must enable the winrm service on the windows platform.

My environment is Windows 10 Enterprise Edition.


The winrm service is not enabled by default, so start the winrm service first.

The first step is to set the winrm service to delayed start and start the service.

The second step is to run powershell as an administrator and execute the following script

$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

After execution as shown below


The third step is to configure the encryption method for winrm service to allow non-encryption:

winrm set winrm/config/service '@{AllowUnencrypted="true"}'

After performing the above steps, the windows configuration is just fine.
Reference materials: https://docs.ansible.com/ansible/latest/user_guide/windows_setup.html

Guess you like

Origin blog.csdn.net/u014108439/article/details/86712658