根据文档rg
,我应该跑
$ sudo yum-config-manager --add-repo=https://copr.fedorainfracloud.org/coprs/carlwgeorge/ripgrep/repo/epel-7/carlwgeorge-ripgrep-epel-7.repo
$ sudo yum install ripgrep
我如何首先将其yum-config-manager
放入ansible中?
答案1
更好的是,尝试使用这样的东西:
- name: Ripgrep Repo
get_url:
url: https://copr.fedorainfracloud.org/coprs/carlwgeorge/ripgrep/repo/epel-7/carlwgeorge-ripgrep-epel-7.repo
dest: /etc/yum.repos.d/copr_ripgrep.repo
如果您不介意安装yum-config-manager
.
旧答案
您实际上不需要yum-config-manager
完成此任务。该命令在此上下文中所做的所有操作就是将该远程文件放入/etc/yum.repos.d/
.之后,yum
将能够从该存储库中提取包。就像是,
sudo wget -O /etc/yum.repos.d/copr_ripgrep.repo https://copr.fedorainfracloud.org/coprs/carlwgeorge/ripgrep/repo/epel-7/carlwgeorge-ripgrep-epel-7.repo
...应该可以解决问题。如果不可用,curl
也可以工作。wget
或者,您可以yum-config-manager
先安装,然后按照您提到的方式使用它。
答案2
我不确定您是否可以通过 url 添加 .repo,所以我所做的就是打开它并将其转换为 .repo 所需的指令yum-repository
。
name: Add repository for ripgrep for epel7
yum_repository:
name: cgor
description: EPEL YUM repo
baseurl: https://copr.fedorainfracloud.org/coprs/carlwgeorge/ripgrep/repo/epel-7/carlwgeorge-ripgrep-epel-7.repo
name: copr
description: Copr repo for ripgrep owned by carlwgeorge
baseurl: https://copr-be.cloud.fedoraproject.org/results/carlwgeorge/ripgrep/epel-7-$basearch/
gpgkey: https://copr-be.cloud.fedoraproject.org/results/carlwgeorge/ripgrep/pubkey.gpg
gpgcheck: yes
repo_gpgcheck: no
enabled: yes
skip_if_unavailable: true
我不会接受这一点,因为我认为这并不理想。