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. vue-moment的使用

    1.安装:npm install moment --save 2.导入:import moment from 'moment'; 3.定义全局时间过滤器:  Vue.filter('converDat ...

  2. Docker 后台进程参数-------更改Docker运行根目录的方法

    参数 介绍 --api-enable-cors=false 远程API调用. -b, --bridge="" 桥接一个系统上的网桥设备到 Docker 容器里,当使用 none 可 ...

  3. [LeetCode] 195. Tenth Line_Easy tag: Bash

    Given a text file file.txt, print just the 10th line of the file. Example: Assume that file.txt has ...

  4. 3.keras实现-->高级的深度学习最佳实践

    一.不用Sequential模型的解决方案:keras函数式API 1.多输入模型 简单的问答模型 输入:问题 + 文本片段 输出:回答(一个词) from keras.models import M ...

  5. Linux命令:查看文件内容cat|tac|more|less|head|tail|nl|od

    查看文件内容的命令;cat, tac, more, less, head, tail, nl, 1)cat 由第一行开始显示文档内容,一直显示到最后 2)tac 从最后一行开始显示,一直显示到第一行内 ...

  6. chrome谷歌浏览器用这种方式清除缓存比较方便了,必须是调试模式才行

     chrome谷歌浏览器用这种方式清除缓存比较方便了  PS:必须是调试模式才行,可以不是手机模式 ,有些低版本浏览器可能没有这个功能.   ----------------------------- ...

  7. 安装SQL2008时显示:RebootRequiredCheck 检查是否需要挂起计算机重新启动。

    解决方法: a.在开始->运行中输入regeditb.删除HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Serverc.删除HKEY_LO ...

  8. Hive学习之路 (五)DbVisualizer配置连接hive

    一.安装DbVisualizer 下载地址http://www.dbvis.com/ 也可以从网上下载破解版程序,此处使用的版本是DbVisualizer 9.1.1 具体的安装步骤可以百度,或是修改 ...

  9. mysql8.0无法给用户授权或提示You are not allowed to create a user with GRANT的问题

    提示意思是不能用grant创建用户,mysql8.0以前的版本可以使用grant在授权的时候隐式的创建用户,8.0以后已经不支持,所以必须先创建用户,然后再授权,命令如下: mysql> CRE ...

  10. SNMP学习笔记之Centos7配置SNMP服务

    0x00 安装yum源安装SNMP软件包 1.yum源安装SNMP服务: yum -y install net-snmp net-snmp-utils 2.查看SNMP版本号: snmpd -v 0x ...