ansible copy文件比较慢, 使用Synchronize模块
Ansible中的同步模块(rsync)
Synchronize模块
|
1
2
3
4
5
6
7
|
This is a wrapper around rsync. Of course you could just use the command action to call rsync yourself, but you also have to add a fair number of boilerplate options and host facts. You still may need to call rsync directly via `command' or `shell' depending on your use case. The synchronize action is meant to do common things with `rsync' easily. It does not provide access to the full power of rsync, but does make most invocations easier to follow. |
这是一个关于rsync的模块。
|
参数 |
必填 |
默认值 |
选项 |
说明 |
|
archive |
no |
yes |
yes no |
显示rsync的存档标志所属信息 |
|
checksum |
no |
no |
yes no |
校验 |
|
compress |
no |
yes |
yes no |
在传送过程中压缩文件数据 |
|
dest |
yes |
目标路径,路径可以绝对或相对 |
||
|
delete |
no |
no |
yes no |
删除srv中不存在的文件 |
|
copy_links |
no |
no |
yes no |
复制符号链接,是映射的文件复制 |
|
dest_port |
no |
22 |
yes no |
目标主机端口号(ansible_ssh_port优先于此值) |
|
group |
no |
存档选项值 |
yes no |
保留文件的所属组 |
|
owner |
no |
存档选项值 |
yes no |
保留文件的所属者(只有超级用户可以操作) |
|
perms |
no |
存档选项值 |
yes no |
保留文件的权限 |
|
rsync_opts |
no |
no |
通过此选项指定其他的rsync的选项 |
|
|
rsync_path |
no |
指定rsync命令到远程主机上运行 |
||
|
rsync_timeout |
no |
0 |
指定rsync的timeout时间以秒为单位 |
|
|
src |
yes |
源地址(路径可以是绝对或相对的) |
||
|
times |
no |
存档选项值 |
yes no |
保留文件的修改时间 |
|
exclude-from |
no |
no |
yes no |
用于定义排除多个文件夹和文件 |
|
exclude |
no |
no |
yes no |
用于定义排除单独的文件夹和文件 |
实例展示:
|
1
2
3
4
5
6
|
---- hosts: web remote_user: deploy tasks: - name: webserver update web server (--exclude-file) synchronize: src=/home/deploy/webserver/ dest=/data/web/webserver/ rsync_opts=--delete,--exclude-from=/data/ansible/public/excludefile |
实际使用:比用copy模块速度增加很多
cat stbverify_update.yml
---
- name: handlers adserver
hosts: adservers
user: root
tasks:
- name: copy file
synchronize: src=/etc/ansible/STBVerify dest=/root/ rsync_opts=--delete
notify: stbverify handlers
handlers:
- name: stbverify handlers
shell: /bin/bash /data/sh/stbverify_update.sh
原文:https://www.cnblogs.com/weifeng1463/p/8484316.html
ansible进阶:https://www.ibm.com/developerworks/cn/linux/1608_lih_ansible/index.html
ansible copy文件比较慢, 使用Synchronize模块的更多相关文章
- ansible笔记(4):常用模块之文件操作
前文中,我们已经介绍了怎样使用模块,而且我们知道,ansible有很多模块,每个模块都有自己的功能,"模块"涉及到的方向比较多,所以对于个人来说,并没有必要了解所有的模块,我们只需 ...
- Ansible系列(二):选项和常用模块
html { font-family: sans-serif } body { margin: 0 } article,aside,details,figcaption,figure,footer,h ...
- synchronize模块
synchronize模块 使用rsync同步文件,其参数如下: archive: 归档,相当于同时开启recursive(递归).links.perms.times.owner.group.-D选项 ...
- Ansible自动化搭建及工具集和常见模块、命令详情(重点)
一.ansible介绍 1.ansible简介 官方的title是“Ansible is Simple IT Automation”——简单的自动化IT工具. Ansible跟其他IT自动化技术的区别 ...
- Ansible自动化运维工具及其常用模块
Ansible自动化运维工具及其常用模块 目录 Ansible自动化运维工具及其常用模块 一.Ansible简介 1. Ansible概述 2. Ansible作用 3. Ansible的工作模块 4 ...
- shutil模块(高级的文件、文件夹、压缩包处理模块)
shutil 模块 高级的 文件.文件夹.压缩包 处理模块 shutil.copyfileobj(fsrc, fdst[, length])将文件内容拷贝到另一个文件中 import shutil s ...
- shutil 模块 高级的文件、文件夹、压缩包 处理模块
高级的文件.文件夹.压缩包 处理模块 # 将文件内容拷贝到另一个文件中 shutil.copyfileobj(fsrc, fdst[, length]) import shutil shutil.co ...
- shutil——高级的 文件、文件夹、压缩包 处理模块
高级的 文件.文件夹.压缩包 处理模块 shutil.copyfileobj(fsrc, fdst[, length])复制文件内容(不包含元数据)从类文件对象src到类文件对dst.可选参数leng ...
- Cocos2d-x建工程时避免copy文件夹和库
方法一:(官方做法) 打开F:\cocos2d-1.0.1-x-0.9.1目录下的cocos2d-win32.vc2010.sln文件,然后右键点击解决方案,选择"添加"—&quo ...
随机推荐
- 【转载】深入理解JVM性能调优
性能问题无非就这么几种:CPU.内存.磁盘IO.网络.那我们来逐一介绍以下相关的现象和一些可能出现的问题. 一.CPU过高. 查看CPU最简单的我们使用任务管理器查看,如下图所示,windows下使用 ...
- How to check the 'OLE DB Destination' INPUT and OUTPUT
Step 1: Step 2: Step 3:
- Nginx限制连接和请求
一.ngx_http_limit_conn_module对同一个ip/server的连接数做限制.配置指令:limit_conn_zone语法: limit_conn_zone $variable z ...
- List装form
List<MemberPrivilegeForm> formlist = new ArrayList<MemberPrivilegeForm>(); int status = ...
- Unity3d修炼之路:游戏开发中,3d数学知识的练习【1】(不断更新.......)
#pragma strict public var m_pA : Vector3 = new Vector3(2.0f, 4.0f, 0.0f); public var m_pB : Vector3 ...
- STL学习笔记(第二章 C++及其标准程序库简介)
本章重点是介绍与C++标准程序库相关的几个最重要的语言新特性 template(模板) 程序库中几乎所有东西都被设计成template形式.所谓templates,是针对“一个或多个尚未明确的型别”所 ...
- IIS7 经典模式和集成模式的区别分析
IIS7.0中的Web应用程序有两种配置模式:经典模式和集成模式.两者区别大家可以参考下,根据实际情况选用. 经典模式是为了与之前的版本兼容,使用ISAPI扩展来调用ASP.NET运行库,原先运行于I ...
- 工作总结 无法确定条件表达式的类型,因为“<null>”和“System.DateTime”之间没有隐式转换 解决办法 object——Nullable<T> (可空类型)
可空值类型 备注 一种类型认为是可以为 null,如果它可以分配一个值,也可以分配null,这意味着类型具有无论如何没有值. 默认情况下,所有都引用类型,如String,是否可以为 null, ...
- Python---copy()、deepcopy()与赋值的区别
copy()与deepcopy()之间的主要区别是python对数据的存储方式. 首先直接上结论: —–深复制,即将被复制对象完全再复制一遍作为独立的新个体单独存在.所以改变原有被复制对象不会对已经复 ...
- 搭建Squid反向代理服务器
好吧,更新个文章,有段时间没写技术博文了.今天就说说squid反向代理这个服务,当然,这是在Linux下配置完成的.说自己没偏见似乎不可能 了.大概是相对喜欢Linux而已.但我从不否认Windows ...