[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