首页 > 技术文章 > Linux-005-ansible 安装

fengpingfan 2017-11-09 00:04 原文

 # 安装依赖

yum install rpm-build python2-devel sshpass PyYAML python-jinja2 python-paramiko python-six python2-cryptography

git clone git://github.com/ansible/ansible.git
cd ansible/
make rpm
cd rpm-build/
sudo rpm -Uvh ansible-*.noarch.rpm

# 添加host
vi /etc/ansible/hosts


# 查看服务器是否连通
ansible all -m ping

 

# 远程执行本地脚本
$ ansible 172.16.10.15 -m script -a '~/shell/getSysInfo' -u huateng

 

 

问题汇总:

1、远程服务器执行本地脚本时提示:command not found

具体现象如下

解决方法:

在执行脚本的时候,加载当前的环境变量即可。

 

推荐阅读