[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

END


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM