先找一台服务器安装epel源,并下载ansible相关软件包
# yum install epel-release -y
# yum install ansible
2, 建一个目录,将所有下载的rpm包拷贝进去
# mkdir /ansible_soft
# cp /var/cache/yum/x86_64/7/epel/packages/* /ansible_soft/
# cp /var/cache/yum/x86_64/7/base/packages/* /ansible_soft/
# cp /var/cache/yum/x86_64/7/extras/packages/* /ansible_soft/
# cp /var/cache/yum/x86_64/7/updates/packages/* /ansible_soft/
3, 创建本地仓库
# createrepo /ansible_soft/
# ls /ansible_soft/
ansible-2.7.5-1.el7.noarch.rpm python-jinja2-2.7.2-2.el7.noarch.rpm
libtomcrypt-1.17-26.el7.x86_64.rpm python-keyczar-0.71c-2.el7.noarch.rpm
libtommath-0.42.0-6.el7.x86_64.rpm python-markupsafe-0.11-10.el7.x86_64.rpm
python2-crypto-2.6.1-15.el7.x86_64.rpm python-paramiko-2.1.1-9.el7.noarch.rpm
python2-jmespath-0.9.0-3.el7.noarch.rpm repodata
python-babel-0.9.6-8.el7.noarch.rpm sshpass-1.06-2.el7.x86_64.rpm
python-httplib2-0.9.2-1.el7.noarch.rpm
4, 将/ansible_soft/目录拷贝到所有的需要安装ansible的节点(过程省略)
5, 配置本地yum
# cd /etc/yum.repos.d
# mkdir bak
# mv *.repo bak/
# vim ansible.repo
nsible]
name=ansible
baseurl=file:///ansible_soft/
enabled=1
gpgcheck=0
6, 开始安装
# yum clean all
# yum install ansible -y