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. java项目连接jdbc报错:com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server

    java项目连接jdbc报错:com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not creat ...

  2. [django实践]投票app

    code: https://github.com/lannyMa/toupiao polls app介绍 这个例子来源于django官网,恰好2.x版本有中文版. https://docs.djang ...

  3. [LeetCode] 255. Verify Preorder Sequence in Binary Search Tree_Medium tag: Preorder Traversal, tree

    Given an array of numbers, verify whether it is the correct preorder traversal sequence of a binary ...

  4. 数据分析与挖掘 - R语言:K-means聚类算法

    一个简单的例子!环境:CentOS6.5Hadoop集群.Hive.R.RHive,具体安装及调试方法见博客内文档. 1.分析题目--有一个用户点击数据样本(husercollect)--按用户访问的 ...

  5. Linux (RHEL)修改时区

    1.修改配置文件修改为上海时区 vi /etc/sysconfig/clock ZONE="Asia/Shanghai" 2.创建上海时区的软连接 ln -sf /usr/shar ...

  6. php 非递归实现分类树

    本文实例讲述了php通过前序遍历树实现无需递归的无限极分类.分享给大家供大家参考.具体如下: 大家通常都是使用递归实现无限极分类都知道递归效率很低,下面介绍一种改进的前序遍历树算法,不适用递归实现无限 ...

  7. VMware coding Challenge: Coin Toss Betting

    static int CoinTossEndAmount(int betAmount, String coinTossResults) { if (betAmount <=0 || coinTo ...

  8. 20154312《网络对抗》Exp2 后门原理与实践

    常见问题快速链接 Handler failed to bind to xxx.xxx.xx.xxx:xxxx 使用Webcam_snap命令提示1411错误,无法正常拍照 常用后门工具实践 Windo ...

  9. Impala与Hive的比较

    1. Impala架构        Impala是Cloudera在受到Google的Dremel启发下开发的实时交互SQL大数据查询工具,Impala没有再使用缓慢的Hive+MapReduce批 ...

  10. 程序猿职场心理学,教你三进三出“斩”HR拿offer(跳槽必看)

    摘要: 今天主要涉及到的是 HR 在面试时有哪些套路,这样可以见招拆招,斩获 offer! 今天主要涉及到的是 HR 在面试时有哪些套路,这样可以见招拆招,斩获 offer! 主要包括以下内容: 一. ...