您好,欢迎访问一九零五行业门户网

详细介绍Windows下如何使用Ansible应用的实例

环境需求:
* controller 一定要是 linux
* windows  需要:
    1.framework 4.5
    2.powershell 3.0
原料:
    ansible master (centos)
anisble slave (windows sp1)
步骤:
    [linux]
yum -y install python-kerberos.x86_64 python2-winrm.noarch
[windows]
下载 framework 4.5
http://download.microsoft.com/download/b/a/4/ba4a7e71-2906-4b2d-a0e1-80cf16844f5f/dotnetfx45_full_x86_x64.exe
下载 powershell 3.0
https://download.microsoft.com/download/e/7/6/e76850b8-da6e-4ff5-8cce-a24fc513fd16/windows6.1-kb2506143-x64.msu
安装完成后会重启一次
下载 remoting script for ansible
https://github.com/ansible/ansible/blob/devel/examples/scripts/configureremotingforansible.ps1
使用管理员身份运行脚本
使用管理员身份打开powershell
winrm qc

会出现以下错误
这个其实也不算是错误,只需要求改网络的属性:在网络和共享中心中把公共网络,切换成家庭网络
再次执行
winrm qc

接下来需要开启windows 远程操作的相关属性:
winrm set winrm/config/service '@{allowunencrypted="true"}'
winrm set winrm/config/service/auth '@{basic="true"}'
以上就可以看到端口5985 已经起来了
netstat -ano | findstr 5985
使用ansible 测试windows 主机
cat /etc/ansible/hosts
[windows]
10.0.50.100 ansible_ssh_user="administrator" ansible_ssh_pass="123456" ansible_ssh_port=5986 ansible_connection="winrm"
以上就是详细介绍windows下如何使用ansible应用的实例的详细内容。
其它类似信息

推荐信息