ansible机器配置
-
https://docs.ansible.com/
-
安装依赖
yum -y install epel-release yum -y install python-devel yum -y install python-pip yum -y install ansible
-
更新pip
pip install --upgrade pip -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
-
安装
python
中的pywinrm
包pip install pywinrm -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
-
配置
ansible
中的hosts
文件# 修改ansible的配置文件 vim /etc/ansbile/hosts [windows] 192.168.1.10 192.168.1.11 [windows:vars] ansible_ssh_user='Administrator' ansible_ssh_pass='123456' ansible_ssh_port=5985 ansible_connection='winrm' ansible_winrm_server_cert_validation=ignore
-
测试链接
windows
ansible windows -m win_ping
-
链接
windows
成功
windows机器配置
-
https://docs.microsoft.com/en-us/windows/win32/winrm/portal
-
查看
winrm
是否开启# 如果无输出则未开启winrm winrm e winrm/config/listener
- 检查`winrm`配置
- 快速设置`winrm`配置
# 快速开启winrm服务,选择y,默认端口5985 Winrm quickconfig
-
开启基本身份认证
https://docs.vmware.com/cn/vRealize-Automation/7.5/com.vmware.vrealize.orchestrator-use-plugins.doc/GUID-79518969-9B73-48E3-8B05-72C78179F555.html
# 需要用户名和密码的非安全身份验证机制 Set-Item -Path "WSMan:\localhost\Service\Auth\Basic" -Value $false # 为winrm service 配置加密方式为允许非加密 Set-Item -Path "WSMan:\localhost\Service\AllowUnencrypted" -Value $false
-
重启
winrm
服务# 重启winrm服务,使配置生效 Restart-Service winrm
-
查看
winrm
配置winrm get winrm/config/Service