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


本文摘自PHP中文网,作者黄舟,侵删。

环境需求:

* Controller 一定要是 Linux

* Windows 需要:

1.Framework 4.5

2.PowerShell 3.0

原料:

Ansible Master (CentOS)

Anisble Slave (Windows SP1)

步骤:

[Linux]

1

yum -y install python-kerberos.x86_64 python2-winrm.noarch

[Windows]

下载 Framework 4.5

1

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

下载 PowerShell 3.0

1

https://download.microsoft.com/download/E/7/6/E76850B8-DA6E-4FF5-8CCE-A24FC513FD16/Windows6.1-KB2506143-x64.msu

安装完成后会重启一次

下载 Remoting Script for Ansible

1

https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1

使用管理员身份运行脚本

使用管理员身份打开PowerShell

1

winrm qc

会出现以下错误

这个其实也不算是错误,只需要求改网络的属性:在网络和共享中心中把公共网络,切换成家庭网络

再次执行

1

winrm qc

接下来需要开启windows 远程操作的相关属性:

1

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

1

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

以上就可以看到端口5985 已经起来了

1

netstat -ano | findstr 5985

使用ansible 测试windows 主机

1

cat /etc/ansible/hosts

[windows]

1

10.0.50.100 ansible_ssh_user="Administrator" ansible_ssh_pass="123456" ansible_ssh_port=5986 ansible_connection="winrm"

以上就是详细介绍Windows下如何使用Ansible应用的实例的详细内容,更多文章请关注木庄网络博客

相关阅读 >>

Windows 10 ltsb如何激活?Windows 10 ltsb激活方法

Windows电脑网络图标出现感叹号

Windows电脑无法重启

Windows防火墙怎么开启和关闭

Windows中,要删除一个应用程序,正确的操作是什么

Windows电脑如何将cpu性能开到最大

u盘有东西但显示空白怎么解决?

Windows 中,有关文件或文件夹的属性说法不正确的是什么

win10改win7系统怎么弄

Windows上如何安装docker的代码实例分享

更多相关阅读请进入《Windows》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...