# 安装依赖

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

Linux-005-ansible 安装

 

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

 Linux-005-ansible 安装

 

问题汇总:

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

具体现象如下

Linux-005-ansible 安装

解决方法:

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

 

相关文章:

  • 2021-06-10
  • 2021-10-30
  • 2021-06-19
  • 2022-01-30
猜你喜欢
  • 2022-12-23
  • 2022-02-16
  • 2022-12-23
  • 2021-06-14
  • 2021-06-15
  • 2021-04-21
相关资源
相似解决方案