码迷,mamicode.com
首页 > 其他好文 > 详细

ansible

时间:2017-09-22 13:12:16      阅读:248      评论:0      收藏:0      [点我收藏+]

标签:des   dep   ceil   拷贝   文件拷贝   flat   ceph   file   yam   

fetch实现将多台服务器的同名文件拷贝到本地且不覆盖

 

---
- hosts: lly
  user: root
  gather_facts: no
  vars:
    eccpt:
     - /etc/ceilometer/pipeline.yaml
     - /etc/ceilometer/ceilometer.conf
     - /etc/nova/nova.conf
     - /etc/libvirt/libvirtd.conf
  tasks:
  - name: copy needed files
    fetch: src={{item}} dest=/var/check_back/lly/{{ lookup(pipe, date +%Y%m%d) }}/{{inventory_hostname}}/ flat=yes
    with_items:
      - "{{eccpt}}"
      
      



ansible clm -m fetch -a src=/etc/keep dest=/var/check_back/lly/{{ lookup(pipe, date +%Y%m%d) }}/{{inventory_hostname}}/ flat=yes 


ansible -i inventory_all clm -m fetch -a src=/etc/keepalived/keepalived.conf dest=/home/deployer/luoliyu/keepalived/20170908/{{inventory_hostname}}/ flat=yes 
ansible -i inventory_all hosts -m fetch -a ‘src=/etc/ceph/ceph.conf dest=/home/onest/luoliyu/config_dir/20170922/{{inventory_hostname}}_ceph.conf flat=yes ‘

  

ansible

标签:des   dep   ceil   拷贝   文件拷贝   flat   ceph   file   yam   

原文地址:http://www.cnblogs.com/luoliyu/p/7495847.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!