@shjanken
2014-12-01T00:48:14.000000Z
字数 515
阅读 840
运维 linux
Ansible 的优点是小巧,轻量。只需要在主控端安装软件而无需在被控端安装任何软件。
Ansible 是通过ssh来和被控端交流。所以最好在被控端配置了ssh互信。
使用包管理器(yum,apt 等)直接安装即可。较简单,略。
Ansible 的使用语法是:
ansible machines -m <module_name> -a <arguments>
Ansible 的模块(Module)
Ansible 支持相当多的模块。其中必要重要的模块有:
copy : 拷贝模块。该模块类似 Linux 系统上的 scp 命令。
ansible all -m copy -a "src=/src/path dest=/remote/dest/path owner=owner group=group mode=0777"
get_url : 下载 URL 资源到(被控主机的)本地。
ansible all -m get_url -a "url=http://url dest=/path mode=0777 force=yes"
yum : 安装软件包。
ansible all -m {yum|apt} -a "pkg=pkg_name state=latest"
