ansible
Created 星期五 25 九月 2015
一,安装
二,常见问题:
~/data/works/sum/ansible/ansible_question.txt 文档:~/data/works/sum/ansible/Ansible-notes.pdf
三,playbooks Detail
~/data/works/sum/ansible/playbooks/playbooks detail.txt
https://github.com/ansible/ansible-examples
+tags用法 +when +roles +defalut.cfg
五,模块详细:
四,常用命令:
ansible 127.0.0.1 -m virt -a "command=list_vms"
ansible -i hosts all -m template -a "src=test.j2 dest=/root/1.txt " --extra-vars={name="123"}
[temp]
192.168.10.9 ansible_ssh_user=root ansible_ssh_user=root
192.168.10.10 ansible_ssh_user=root ansible_ssh_user=root
批理执行date命令
# ansible temp -a "date"
批量传文件
# ansible fh-temp -m copy -a "src=/home/123.zip dest=/root/123.zip"
批量执行脚本
默认情况下,ansible 使用的 module 是 command,这个模块并不支持 shell 变量和管道等,若想使用 shell 来执行模块,请使用-m 参数指定 shell 模块 -m 可指定shell , script, command(default) # ansible fh-temp -m shell -a " df -h" #./ansible -i /home/thankxie/workspace/scripy/appsrc/hosts xiecd -m script -a "/home/thankxie/workspace/scripy/studysrc/test.sh 101"