ansible 配置数据源源头为163

1、基础信息

repos存储位置:/etc/yum.repos.d/  
数据源下载:
CentOS7
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo  

CentOS6
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo  

CentOS5
wget http://mirrors.163.com/.help/CentOS5-Base-163.repo  

2、使用ansible下载repo

ansible webservers -m get_url -a "url=http://mirrors.163.com/.help/CentOS6-Base-163.repo dest=/etc/yum.repos.d"

3、运行yum生成缓存

ansible webservers -m command -a 'yum makecache'

'

4、更新系统就能看到mirrors.163.com信息

用阿里云,只要下载aliyun的yum配置文件到/etc/yum.repos.d/,其它步骤一致
CentOS7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo  

CentOS6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo  

CentOS5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo 

原文地址:https://www.cnblogs.com/zxw-xxcsl/p/11199486.html