安装ansible
centos系统6升级yum源
rpm -ivh http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
yum安装
yum install ansible
定义主机组
vim /etc/ansible/hosts 添加以下内容
[webservers]
192.168.56.101
确认无误wq保存
执行linux命令
ansible webservers -k -m command -a ‘df -h’
远程执行shell脚本
ansible webservers -u root -k -m shell -a ’ python /data/shell_scripts/list.py’