温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Windows下使用Ansible应用

发布时间:2020-03-30 16:07:26 来源:网络 阅读:1893 作者:luweiv998 栏目:系统运维

环境需求:

* 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因为在此系统中禁止执行脚本

执行:

 set-ExecutionPolicy RemoteSigned


    使用管理员身份打开PowerShell 

winrm qc

    会出现以下错误

    Windows下使用Ansible应用

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

Windows下使用Ansible应用

    再次执行

winrm qc

    这次应该是成功了,会显示以下图片:

Windows下使用Ansible应用


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

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

   Windows下使用Ansible应用 

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

    netstat -ano | findstr 5985

Windows下使用Ansible应用

    

    使用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应用


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI