您的位置:首页 > 其它

ansible管理windows主机

2018-02-23 14:51 363 查看
1.安装、配置控制机
https://pypi.python.org/packages/source/p/pywinrm/pywinrm-0.1.1.tar.gz
或者
pip install "pywinrm>=0.1.1"
如果需要支持活动目录需安装python-kerberos模块

2.windows被控制机满足2个条件
1)必须开启WinRM支持远程管理; 2)确保PowerShell版本是3.0或更高版本
WinRM即windows远程管理,监听5985/5986端口
windows启动服务
PS C:\Users\Administrator> powershell Enable-PSRemoting -Force
在此计算机上设置了 WinRM 以接收请求。
在此计算机上设置了 WinRM 以进行远程管理。

开启WinRM支持远程管理
Ansible为了方便用户配置windows环境的WinRM服务,提供了一个初始化windows环境的powershell脚本,地址
https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1
然后在被管理的windows主机上执行就可以
1)检查最后的安装证书的指纹
2)配置错误处理
3)检测PowerShell版本
4)检查启动WinRM服务
5)确保WinRM运行之后,检查有PS会话配置
6)确保有SSL监听
7)检查基本鉴权
8)配置防火墙允许WinRM HTTPS链接
9)本地测试通过网络方式连接是否正常

在powershell上执行: .\ConfigureRemotingForAnsible.ps1

确保powershell 是3.0或更高版本
https://github.com/cchurch/ansible/blob/stable-2.0/examples/scripts/upgrade_to_ps3.ps1
或者
https://www.microsoft.com/en-us/download/details.aspx?id=34595这个软件包括powershell3.0、WMI、WinRM、Management OData IIS Extension和Server Manager CIM Provider
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ansible windows管理