Home >Operation and Maintenance >Windows Operation and Maintenance >Detailed examples of how to use Ansible applications under Windows
Environment requirements:
* Controller must be Linux
* Windows Requirements:
1.Framework 4.5
2.PowerShell 3.0
Materials:
Ansible Master (CentOS)
Anisble Slave (Windows SP1)
Steps:
[Linux ]
yum -y install python-kerberos.x86_64 python2-winrm.noarch
[Windows]
Download Framework 4.5
http://download.microsoft.com/download/B/A/4/BA4A7E71-2906-4B2D-A0E1-80CF16844F5F/dotNetFx45_Full_x86_x64.exe
Download PowerShell 3.0
https://download.microsoft.com/download/E/7/6/E76850B8-DA6E-4FF5-8CCE-A24FC513FD16/Windows6.1-KB2506143-x64.msu
After the installation is complete, it will restart once
Download Remoting Script for Ansible
https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1
Run the script as an administrator
Open PowerShell as an administrator
winrm qc
The following error will appear
This In fact, it is not an error. You only need to change the network properties: switch the public network to the home network in the Network and Sharing Center
Execute again
winrm qc
Next, you need to enable Windows remote operation Related attributes:
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
winrm set winrm/config/service/auth '@{Basic="true"}'
Above you can see that port 5985 is up
netstat -ano | findstr 5985
Use ansible to test the windows host
cat /etc/ansible/hosts
[windows]
10.0.50.100 ansible_ssh_user="Administrator" ansible_ssh_pass="123456" ansible_ssh_port=5986 ansible_connection="winrm"
The above is the detailed content of Detailed examples of how to use Ansible applications under Windows. For more information, please follow other related articles on the PHP Chinese website!