ansible--与托管节点(windows)系统通信

由于ansible是通过PowerShell与windows系统通信的,为了 Ansible 能管理windows机器,必须开启并配置远程机器上PowerShell,并需要安装以下工具:

  1. 需要 PowerShell 3.0 或更高版本

下载地址:

https://github.com/PowerShell/PowerShell/releases/download/v6.1.0/PowerShell-6.1.0-win-x86.msi

安装完后,运行powershell,输入get-host命令查看版本

ansible--与托管节点(windows)系统通信

ansible--与托管节点(windows)系统通信

 

  1. 需要Management Framework 4.0

下载地址:http://download.microsoft.com/download/B/A/4/BA4A7E71-2906-4B2D-A0E1-80CF16844F5F/dotNetFx45_Full_x86_x64.exe

 

  1. 更改powershell策略

1)在powershell中运行:set-executionpolicy remotesigned ,遇到询问就输入 y 。

ansible--与托管节点(windows)系统通信

 

2)winrm service 进行基础配置

winrm quickconfig

3)winrm service 配置auth:

winrm set winrm/config/service/auth @{Basic="true"}

4)winrm service 配置为非加密:

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

完成配置后,运行:winrm enumerate winrm/config/listener

如果看到显示如下图所示则表示已启动,如无任何返回信息则表示没有启动:

ansible--与托管节点(windows)系统通信