要求:linuxCentOSrelease6.8(Final)两台机器:192.168.1.2192.168.1.31.只在192.168.1.2安装yuminstallepel-releaseyuminstallansible2.在192.168.1.2上生成密钥对ssh-keygen-trsa不设置密码回车cat/root/.ssh/id_rsa.pub>>/root/.ssh/authorized_keyscat/root/.ssh/id_..
分类:
其他好文 时间:
2017-03-21 13:16:03
阅读次数:
132
YAML简介YAML是一个可读性高的用来表达资料序列的格式。YAML参考了其他多种语言,包括:XML、C语言、Python、Perl以及电子邮件格式RFC2822等。ClarkEvans在2001年在首次发表了这种语言,另外IngydtNet与OrenBen-Kiki也是这语言的共同设计者。YAMLAin‘tMarkupLanguage,即YAML不..
分类:
系统相关 时间:
2017-03-21 11:33:43
阅读次数:
266
ansible http://www.cnblogs.com/ee900222/p/ansible.html http://ju.outofmemory.cn/entry/67581 ansible vs puppet vs saltstack ansible http://www.cnblogs. ...
分类:
其他好文 时间:
2017-03-19 13:05:33
阅读次数:
135
一、Hibernate的基本使用 首先需要配置相应的配置文件 Hibernate基本使用步骤 1.创建org.hibernate.cfg.Configuration对象 2.调用configure方法将配置文件放入其中 3.调用buildSessionFactory()方法创建SessionFact ...
分类:
Web程序 时间:
2017-03-18 23:56:03
阅读次数:
392
#!/bin/bash#justpreventyouhavesshkeyrm-rf/root/.ssh/id_dsa*ssh-keygen-tdsa-f/root/.ssh/id_dsa-P"">>/dev/null2>&1#allcanssheachotherforipin$*do sshpass-p123456ssh-copy-id-i/root/.ssh/id_dsa.pub"-oStrictHostKeyChecking=noroot@$ip">>/dev/nul..
分类:
其他好文 时间:
2017-03-17 21:12:32
阅读次数:
279
相对yum安装,pip安装的好处是jinjia版本到了2.8 pip安装ansible Successfully installed MarkupSafe-1.0 PyYAML-3.12 ansible-2.2.1.0 jinja2-2.8.1 paramiko-2.1.2 pyasn1-0.2.3... ...
分类:
其他好文 时间:
2017-03-17 17:37:56
阅读次数:
260
想通过ansible在管理的各数据库服务器执行操作数据库的一个shell脚本,跑脚本的时候发现部分服务器能执行成功,部分服务器失败了,报错信息为errorwhileloadingsharedlibraries:libtinfo.so.5。经过对比,发现执行失败的服务器为centos5的系统。其实系统已经装过ncurses包了,..
分类:
其他好文 时间:
2017-03-16 22:24:37
阅读次数:
251
python通过ansible获取服务器基本信息:#!/usr/bin/envpython
#coding:utf-8
defsever_info(ip)
cmd="/usr/bin/ansible{ip}-msetup".format(ip=ip)
raw_info=subprocess.check_output(cmd,shell=True)
base_info=json.loads(raw_info.split(‘=>‘)[1])[‘ansible_facts‘]
cpu..
分类:
编程语言 时间:
2017-03-15 12:53:43
阅读次数:
223
首先需要了解ssh普通用户登陆的做法:1.普通用户ssh免密登陆举个例子:[A@source~]$sshuser@10.0.0.1表示当前用户A(可以是root或者任何其他用户)以用户user登陆10.0.0.1,如果省略用户,即:ssh10.0.0.1,表示以当前用户A登陆这里记住两个用户:A:当前用户,执行ssh的用户user..
分类:
其他好文 时间:
2017-03-14 21:44:00
阅读次数:
484
目的:利用ansible获取后端服务器数据每天备份结果平台:Django1.views.py中添加函数defbackup_status(request):
arg_mysql="du-sh/backup/mysql/db/`date-I`"
arg_mongo="du-sh/backup/mongodb/`date-I`"
arg_data=‘tail-n3/var/log/rsync_data.`date+"%Y%m%d2301"-d"-1day"`‘..
分类:
其他好文 时间:
2017-03-14 21:39:31
阅读次数:
204