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. 不能安装64位office提示已安装32位的

    安装64位office办公软件的时候提示已经安装32位的office办公软件所以无法继续安装,但实际上之前安装的32位的office办公软件已经卸载了.问题现象截图如下: 从问题描述中,我们其实已经能 ...

  2. html 之 img hspace 和 vspace 属性

    案例<img src="w3school.gif" hspace="30" vspace="30" /> 描述 通常图形浏览器不 ...

  3. 6、tcp_wrapper

    iptables的链接跟踪表最大容量为/proc/sys/net/ipv4/ip_conntrack_max,链接碰到各种状态的超时后就会从表中删除. 所以解決方法一般有两个: (1) 加大 ip_c ...

  4. HDU 6249 Alice’s Stamps(dp)

    http://acm.hdu.edu.cn/showproblem.php?pid=6249 题意: 给出n个区间,求选k个区间的最大区间并. 思路: 可能存在左端点相同的多个区间,那么此时我们肯定选 ...

  5. git pull 提示 There is no tracking information for the current branch

    在执行git pull的时候,提示当前branch没有跟踪信息: git pull There is no tracking information for the current branch. P ...

  6. 【Python】【有趣的模块】【requests】【二】快速上手

    [一]参数及结果 [二]响应内容 >>> r = requests.get('https://github.com/timeline.json') >>> prin ...

  7. Educational Codeforces Round 23 C. Really Big Numbers 暴力

    C. Really Big Numbers time limit per test 1 second memory limit per test 256 megabytes input standar ...

  8. activity 的跳转

    在app文件夹上右键新建空的activity ,名称为DisplayMessageActivity, 修改layout文件夹下activity_display_message.xml <?xml ...

  9. Ubuntu18.04下搭建LAMP环境

    一.Apache2 web 服务器的安装 : 可以先更新一下服务器 1.sudo apt-get update             # 获取最新资源包 2.sudo apt-get upgrade ...

  10. sklearn preprocessing (预处理)

    预处理的几种方法:标准化.数据最大最小缩放处理.正则化.特征二值化和数据缺失值处理. 知识回顾: p-范数:先算绝对值的p次方,再求和,再开p次方. 数据标准化:尽量将数据转化为均值为0,方差为1的数 ...