1、主控端安装ansible
        1) pip install ansible
2、主控端安装相关的包
pip install http://github.com/diyan/pywinrm/archive/master.zip#egg=pywinrm
apt-get install libkrb5-dev
pip install kerberos
         pip install paramiko PyYAML Jinja2 httplib2 six
3、配置windows
        1) 升级到.net 3.0以上
            下载链接为:http://download.microsoft.com/download/B/A/4/BA4A7E71-2906-4B2D-A0E1-80CF16844F5F/dotNetFx45_Full_x86_x64.exe。 下载至本地后双击左键安装即可,期间可能会多次重启,电脑需正常连接Internet。
        2) 升级到powershell 3.0以上
            下载链接为https://github.com/cchurch/ansible/blob/devel/examples/scripts/upgrade_to_ps3.ps1,下载后在powershell中执行就可以了
        3) 执行$host和$psversiontable查看版本,ps是$host的Version,.net是$psveriontable的CLRVersion
                
        4) 更改powershell策略为remotesigned
            set-executionpolicy remotesigned
            
            或者修改注册表HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft\PowerShell
                

        5) 在powershell中执行winrm qc启动winrm
        6) 在cmd中执行   
            > winrm set winrm/config/service '@{AllowUnencrypted="true"}'
            > winrm set winrm/config/service/auth '@{Basic="true"}'
                
4、修改ansible服务端
        1) 修改默认得到Inventory /etc/ansible/hosts,添加
            [windows]
            192.168.56.101 ansible_ssh_user="Administrator" ansible_ssh_pass="geely@2018" ansible_ssh_port=5985 ansible_connection="winrm" ansible_winrm_server_cert_validation=ignore
        2) 测试:
                ansible 192.168.56.101 -m win_ping 

Ansible 操作windows的更多相关文章

  1. ansible管理windows实践

    一.前言 近期打算搞搞自动部署,因为是windows服务器,一些工具和系统支持都不是太好.最后发现ansible比较火,最重要的是他支持windows.本文主要就ansible 在windows使用环 ...

  2. ansible控制windows的官方翻译

    Ansible控制windows 1.    Windows下如何工作 在ansible控制linux的时候,用的是ssh的方式,在windows中,使用的是power shell,在客户端机器上也是 ...

  3. [转帖]Ansible管理windows集群

    Ansible管理windows集群 http://www.cnblogs.com/Dev0ps/p/10026908.html 写的挺好的 我关注点还是不够好呢 最近公司新项目需要安装400+win ...

  4. winreg操作windows注册表详解示例

    #coding:utf-8 #=====================================================================#=====本程序演示了WINR ...

  5. C语言操作WINDOWS系统存储区数字证书相关函数详解及实例

     C语言操作WINDOWS系统存储区数字证书相关函数详解及实例 以下代码使用C++实现遍历存储区证书及使用UI选择一个证书 --使用CertOpenSystemStore打开证书存储区. --在循环中 ...

  6. C# 操作windows服务[启动、停止、卸载、安装]

    主要宗旨:不已命令形式操作windows服务 static void Main(string[] args) { var path = @"E:\开发辅助项目\WCF\WCF.Test\WC ...

  7. ansible管理windows (发送文件)

    https://github.com/ansible/ansible/raw/devel/examples/scripts/ConfigureRemotingForAnsible.ps1 环境: 服务 ...

  8. 全键盘操作Windows

    计算机机用户在使用计算机的时候,是用键盘多一点?还是用鼠标多一点?如果是专业打字员,应该会说他使用键盘多一点,除此之外,多数人都会告诉你,他已经离不开鼠标了,没有鼠标,就不会操作电脑.   如果某一天 ...

  9. 【ANSIBLE】ansible控制windows插件安装及运行error与解决方法

    一. 问:因pip版本问题无法安装kerberos 答:安装提示需要先安装pip升级包 下载pip9.0.1升级包: https://pypi.python.org/packages/b6/ac/70 ...

随机推荐

  1. android 网络监测

    public class NetWorkStateReceiver extends BroadcastReceiver { @Override public void onReceive(Contex ...

  2. 12 jmeter性能测试实战--web程序

    项目背景 项目:XX网站环境:Windows需求:并发登录的性能测试场景:1s增加2个线程,运行2000次(线程数20,Ramp-Up seconds 10,循环次数100).分别看20.40.60并 ...

  3. ubuntu 安装ftp nginx tomcat,mysql

    tomcat sudo apt-get install tomcat 访问方式,http://loclahost:8080 进入sbin目录下 sudo ./startup.sh开启 sudo ./s ...

  4. Filter与Servlet的区别与联系

    Filter与Servlet的区别与联系 转自 http://blog.csdn.net/gaibian0823/article/details/51027495 在我们写代码时,在web.xml中总 ...

  5. javascript产生对象(不建议看)

    产生对象的方式:一.new+构造函数1.JavaScript的内置构造函数,如Date(),Function(),Array(),Object()2.自定义的构造函数二.对象字面量{}三.继承 用 v ...

  6. Http请求中Content-Type和Accept讲解以及在Spring MVC中的应用

    在Http请求中,我们每天都在使用Content-type来指定不同格式的请求信息,但是却很少有人去全面了解content-type中允许的值有多少,这里将讲解Content-Type的可用值,以及在 ...

  7. js之数组排序

    数组,大家都不陌生,只要是学编程的人都知道这个入门的数据结构,在js中也是有数组这个概念的,跟普通的数组一样只是定义的形式不同罢了.下面是一个数组的排序代码: <html> <hea ...

  8. windows上mysql的配置文件my.ini内容

    # Other default tuning values# MySQL Server Instance Configuration File# --------------------------- ...

  9. SV中的task和function

    SV中class的properties和methods默认都是public的,但是可以声明为local和protected. 一个properties声明为local类型的,则只在该class中的me ...

  10. 文件操作(CRT、C++、WIN API、MFC)

    一.使用CRT函数文件操作 二.使用标准C++库 std::fstream std::string 1)std::string对象内部存储了一个C的字符串,以'\0'结尾的. 2)std::strin ...