发表于 2018-7-30 07:01:12

shell脚本之安装ansible(centos7环境)

#!/usr/bin/env bash  

  
ansilbe
  

  
if [ $? -eq 0 ]    #检查上一命令是否执行成功,如不等于0,则进行安装
  
then
  
      echo 'ansible existing'
  
else
  
      #设置EPEL仓库
  
      rpm -iUvh http://dl.Fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
  

  
      #使用yum安装Ansible
  
      yum -y install ansible
  

  
      #安装完成后,检查ansible版本
  
      vers=`ansible --version`
  
      echo "ansible install complete, version=$vers"
  
fi
页: [1]
查看完整版本: shell脚本之安装ansible(centos7环境)