[Ansible]yum_repository模組 新增 刪除yum源
阿新 • • 發佈:2020-09-14
新增yum源
ansible all -m yum_repository -a "name=epel \
description='EPEL TUM repo' \
baseurl='http://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