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

环境:

服务器端

python2.7

centos7

ansible        yum install ansible

被管理windows端 win-server2012需要powershell 3.0 +开启winrm服务 +开启防火墙规则+配置powershell策略为remotesigned 

 一、python 依赖包安装

下载pip
#wget https://bootstrap.pypa.io/get-pip.py
#python get-pip.py
安装依赖
#pip install pywinrm paramiko PyYAML Jinja2 httplib2 six

二、hosts文件配置

vim  /etc/ansible/hosts

[windows]
47.107.24.1 ansible_winrm_transport=ntlm ansible_ssh_user="Administrator" ansible_ssh_pass="" ansible_ssh_port= ansible_connection="winrm" ansible_winrm_server_cert_validation=ignore

三、win 设置

# 创建目录
mkdir c:\ansible
cd c:\ansible # 下载脚本
wget https://github.com/ansible/ansible/raw/devel/examples/scripts/ConfigureRemotingForAnsible.ps1 # 开启WinRM服务
set-ExecutionPolicy RemoteSigned #开启防火墙端口
netsh advfirewall firewall add rule name="Win-RM-HTTP" dir=in localport=5985 protocol=TCP action=allow

四、执行命令发送文件

ansible "*"  -m win_copy -a  "src=/tmp/ansible_test dest=c:/ansible"

参考文档:https://www.jianshu.com/p/0ad50049adb7

ansible管理windows (发送文件)的更多相关文章

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

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

  2. 厉害—Ansible管理windows集群

    最近公司新项目需要安装400+windows server 2012系统的工作站,想着怎么能像linux下运用ansible批量管理,linux就很简单了有ssh服务 但是下却没这么简单,但还是有办法 ...

  3. ansible管理windows实践

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

  4. ansible管理windows主机

    1. 在windows开启winrm winrm service 默认都是未启用的状态,先查看状态:如无返回信息,则是没有启动: winrm enumerate winrm/config/listen ...

  5. Ansible 管理Windows 受控端

       

  6. Ansible学习笔记(一):部署管理Windows机器遇到的一些坑

    在给国盛通上海测试环境做Ansible管理Windows服务器的时候,遇到了一些坑,Google解决掉了,特此记录,坑用红色标记. 一.环境说明 1.Ansible管理主机 操作系统:CentOS 7 ...

  7. [转帖]Ansible批量远程管理Windows主机(部署与配置)

    2018-09-12 12:04:42 https://blog.51cto.com/7424593/2174156 一.测试环境介绍 Ansible管理主机: 系统:   CentOS6.8 IP ...

  8. Ansible 批量管理Windows Server服务器

    Ansible批量管理Windows Server         Ansible是一款为类Unix系统开发的自由开源的配置和自动化工具,  它用Python写成,类似于saltstack和Puppe ...

  9. Ansible批量远程管理Windows主机(部署与配置)

    一.测试环境介绍 Ansible管理主机: 系统:   CentOS6.8 IP Addr: 172.16.10.22 Linux管理服务器需安装pip.pywinrm插件 Windows客户端主机: ...

随机推荐

  1. POJ 3126 Prime Path(素数路径)

    POJ 3126 Prime Path(素数路径) Time Limit: 1000MS    Memory Limit: 65536K Description - 题目描述 The minister ...

  2. 1、iptables-netfilter基础

    .iptables: 包过滤型防火墙功能.四表五链 .iptables规则.规则管理工具.iptables命令 .iptables链管理.规则管理.查看等 .iptables匹配条件.目标.显式扩展. ...

  3. javaScript 内置对象-Array数组

    Array 对象方法 方法 描述 concat() 连接两个或更多的数组,并返回结果. join() 把数组的所有元素放入一个字符串.元素通过指定的分隔符进行分隔. pop() 删除并返回数组的最后一 ...

  4. MySQL GROUP BY语句

    GROUP BY 语句根据一个或多个列对结果集进行分组 在分组的列上我们可以使用COUNT.SUM.AVG等函数 SELECT column_name,function(column_name) FR ...

  5. 【Ruby】【目录 & 引用 & 文件 】

    [[目录]] 当前文件在根目录下一个文件夹下 引用当前文件所在目录上一级目录下某.rb文件 方法一 require File.join(File.dirname(FILE),'..','test_on ...

  6. android studio 的基本使用和建立一个小项目

    https://github.com/allenxieyusheng/Android-Studio

  7. js_为元素动态注册事件

    <head> <title></title> <script type="text/javascript">//window.onl ...

  8. tslint无法工作:Failed to load the TSLint library for the document

    1--- 2--- 3---

  9. git tag 用法 功能作用

    前言 最近使用git管理一个项目, 当需要将稳定的代码发布成一个版本,git的标签操作刚好满足需求 用途 标签可以针对某一时间点的版本做标记,常用于版本发布,这恰恰是我所需要的功能,将本地标签推送到G ...

  10. R语言 set.seed()函数

    看了几个帖子,说得不是特别清楚,特重新描述如下: set.seed()函数是为了保证你随机生成的随机数前后一致,看效果 首先,不设置该种子函数. x=rnorm(10) plot(x)绘出的图如下: ...