部署ansible
1.安装ansible、被控主机需要安装python、windows需要配置客户端winrm
1.ansible
cat ansible.cfg(简易文件)
[defaults]
host_key_checking = false #不检测密钥
inventory = inventory
主机清单
cat inventory
[l_server] #linux系统
ip地址 ansible_ssh_user=root ansible_ssh_pass='密码' ansible_ssh_port=端口
[w_server] #windows系统
ip地址 ansible_user=administrator ansible_password=密码 ansible_connection=winrm ansible_winrm_server_cert_validation=ignore ansible_port=5985
windows系统配置
需要powershell4.0以上(winserver2012以上)
get-executionpolicy 查看powershell运行策略 Restricted才可以
更改策略: set-executionpolicy remotesigned
配置客户端winrm:
winrm quickconfig 开启winrm服务
winrm set winrm/config/service/auth '@{Basic="true"}' 启动远程连接认证
winrm set winrm/config/service '@{AllowUnencrypted="true"}' 启动远程连接认证