yzq 发表于 2018-1-3 10:14:23

范丰平

  # 安装依赖
  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
  具体现象如下

  解决方法:
  在执行脚本的时候,加载当前的环境变量即可。
页: [1]
查看完整版本: 范丰平