Ansible 安装与简单使用

 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


1、安装

  1. $ pip install ansibleubuntu

  2. #for debiancentos

  3. $ sudo apt-add-repository ppa:rquillo/ansiblessh

  4. $ sudo apt-get updateide

  5. $ sudo apt-get install ansibleui

  6. #for centosspa

  7. $ sudo yum install ansible.net

2、环境说明

1. 控制主机为 ubuntu 13.10 
2. 被控端为 2台 ubuntu 12.04 虚拟机 和 一台 centos 6.4 虚拟机
3. 经过ssh 密钥认证

3、初试牛刀

  1. ansible all -m ping           #内建的 ping 模块




  1. ansible all -"/bin/echo hello, world"   #执行命令

  2. ansible all -m command -a "/bin/echo hello, world"

  3. #以上两条命令结果是同样的,由于默认调用 command  模块,因此能够省略, all 表示全部节点, -a 后面是参数






  1. ansible all -m shell -"ping baidu.com -c 1"      # shell 模块



## 转载请注明出处!

转自:http://blog.chinaunix.net/xmlrpc.php?r=blog/index&uid=29253247&sid=191677&pattern=list&page=1

相关文章
相关标签/搜索