IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    使用 Ansible 传输文件的几种方式

    Yiran\'s Blog发表于 2019-11-22 20:15:17
    love 0
    背景 链接到标题 Ansible 作为一款配置管理和应用部署的软件,日常使用的场景很多,我自己也是重度用户。最近在使用 Ansible 进行文件传输的时候踩了个坑,借此机会整理下 Ansible 传输文件的几种方式。 实验环境: [root@yiran ~]# ansible --version ansible 2.7.12 config file = None configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/site-packages/ansible executable location = /usr/bin/ansible python version = 2.7.5 (default, Aug 7 2019, 00:51:29) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] Template 链接到标题 https://docs.ansible.com/ansible/latest/modules/template_module.html Ansible 一个常用的功能就是配置管理,通过 Ansible 批量分发配置文件,达到统一版本管理的效果,如果我们想要进行少量的文件传输,从控制节点传输到被管理节点,那么可以采用这种方式来完成。 具体的使用官方文档 已经讲的很详细了,这里不再啰嗦。 因为版本是通过 Jinja2 模板传输,支持模板渲染 虽然我们可以在模版中不制定任何参数,直接将其拷贝,但是相比 Copy/Fetch 模块还是需要有模版渲染的一步,速度要慢一些 Copy/Fetch 模块 链接到标题 https://docs.


沪ICP备19023445号-2号
友情链接