Ansible 安装与简单使用 2014-04-06 17:20:38php
转自:http://blog.chinaunix.net/xmlrpc.php?r=blog/index&uid=29253247&sid=191677&pattern=list&page=1 css
======================================================================================shell
$ pip install ansibleubuntu
#for debiancentos
$ sudo apt-add-repository ppa:rquillo/ansiblessh
$ sudo apt-get updateide
$ sudo apt-get install ansibleui
#for centosspa
$ sudo yum install ansible.net
1. 控制主机为 ubuntu 13.10
2. 被控端为 2台 ubuntu 12.04 虚拟机 和 一台 centos 6.4 虚拟机
3. 经过ssh 密钥认证
ansible all -m ping #内建的 ping 模块
ansible all -a "/bin/echo hello, world" #执行命令
ansible all -m command -a "/bin/echo hello, world"
#以上两条命令结果是同样的,由于默认调用 command 模块,因此能够省略, all 表示全部节点, -a 后面是参数
ansible all -m shell -a "ping baidu.com -c 1" # shell 模块
## 转载请注明出处!
转自:http://blog.chinaunix.net/xmlrpc.php?r=blog/index&uid=29253247&sid=191677&pattern=list&page=1