ansible

Posted larlly

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ansible相关的知识,希望对你有一定的参考价值。

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的主要内容,如果未能解决你的问题,请参考以下文章

从jenkinsfile启动包含vault文件引用的Ansible playbook

ansible代码分析第一篇--主文件—ansible分析

python代码调用ansible

Ansible

基于ansible的zabbix源代码安装

需要代码来使用 Ansible 检查服务器连接