配置epel源
装上了 EPEL 之后,就相当于添加了一个第三方源。
CentOS 源包含的大多数的库都是比较旧的。并且,很多流行的库也不存在。EPEL 在其基础上不仅全,而且还够新。
比如安装较新版 ansible 的过程中,需要解决依赖性,但是系统镜像源中对应的软件包都比较旧。所以需要配置epel源。
配置方法
yum 源的路径需要写到repodata的父目录,所以最简单直接的方法就是直接配置阿里云对应的baseurl
$ more epel.repo
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=http://mirrors.aliyun.com/epel/7/$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
查看已配置的源
$ yum repolist
源标识 源名称 状态
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 13,770
下载epel源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
安装ansible
查看ansible信息
$ yum info ansible
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.huaweicloud.com
* extras: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.tuna.tsinghua.edu.cn
已安装的软件包
名称 :ansible
架构 :noarch
版本 :2.9.27
发布 :1.el7
大小 :103 M
源 :installed
来自源:epel
简介 : SSH-based configuration management, deployment, and task execution system
网址 :http://ansible.com
协议 : GPLv3+
描述 : Ansible is a radically simple model-driven configuration management,
: multi-node deployment, and remote task execution system. Ansible works
: over SSH and does not require any software or daemons to be installed
: on remote nodes. Extension modules can be written in any language and
: are transferred to managed machines automatically.
通过yum的方式进行安装
$ yum -y install ansible
查看ansible文件列表
$ rpm -ql ansible
/etc/ansible
/etc/ansible/ansible.cfg # 主配置文件
/etc/ansible/hosts # 主机清单,对那些主机进行管理
/etc/ansible/roles # 角色目录
/usr/bin/ansible
/usr/lib/python2.7/site-packages/ansible/executor/playbook_executor.py # 对应的库文件,很多
/usr/lib/python2.7/site-packages/ansible/executor/playbook_executor.pyc
/usr/lib/python2.7/site-packages/ansible/executor/playbook_executor.pyo
/usr/lib/python2.7/site-packages/ansible/module_utils/aws/direct_connect.pyo
/usr/lib/python2.7/site-packages/ansible/module_utils/aws/elb_utils.py # module_utils 各种模块
/usr/lib/python2.7/site-packages/ansible/module_utils/aws/elb_utils.pyc
/usr/lib/python2.7/site-packages/ansible/modules/files/file.py # 管理文件的模块
......