[Ansible]yum_repository模块 添加 删除yum源
添加yum源
ansible all -m yum_repository -a "name=epel \
description='EPEL TUM repo' \
baseurl='https://mirrors.aliyun.com/epel/7/x86_64/' \
gpgcheck=no \
enabled=yes"
删除yum源 只能删除自己管理过的否则无法删除
ansible all -m yum_repository -a "name=epel \
state=absent"
测试结果
[root@ceph2 ~]# yum repolist
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.tuna.tsinghua.edu.cn
源标识 源名称 状态
Ceph Ceph 107
Ceph_X86_64 Ceph_X86_64 588
base/7/x86_64 CentOS-7 - Base 10,070
epel EPEL TUM repo 13,446
extras/7/x86_64 CentOS-7 - Extras 413
updates/7/x86_64 CentOS-7 - Updates 1,127
repolist: 25,751